diff --git a/src/gentables/CMakeLists.txt b/src/gentables/CMakeLists.txt index 503f0c308..e4fdd81f9 100644 --- a/src/gentables/CMakeLists.txt +++ b/src/gentables/CMakeLists.txt @@ -1,16 +1,20 @@ cmake_minimum_required(VERSION 3.5) -# remove $CC from the current environment and by that force cmake to look for a (working) C compiler, -# which hopefully will be the host compiler -unset(ENV{CC}) +project (gentables C) -# also unset $CFLAGS to avoid passing any cross compilation flags to the host compiler -unset(ENV{CFLAGS}) +if ( CMAKE_CROSSCOMPILING ) -# linker flags as well -unset(ENV{LDFLAGS}) + # remove $CC from the current environment and by that force cmake to look for a (working) C compiler, + # which hopefully will be the host compiler + unset(ENV{CC}) -project (gentables C) + # also unset $CFLAGS to avoid passing any cross compilation flags to the host compiler + unset(ENV{CFLAGS}) + + # linker flags as well + unset(ENV{LDFLAGS}) + +endif () set ( CMAKE_BUILD_TYPE Debug )