Skip to content

Commit

Permalink
gentables: only unset compiler flags if cross-compilation is detected
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiangreffrath committed Jan 31, 2025
1 parent de1daa4 commit ba0c0a6
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/gentables/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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 )

Expand Down

0 comments on commit ba0c0a6

Please sign in to comment.