diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a03f8b..51d2a33 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,10 @@ set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_POSITION_INDEPENDENT_CODE ON) +# add static libgcc and libstdc++ for static linking +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static-libgcc -static-libstdc++") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++") + option(TILE_BUILD_TESTS "Build tests" OFF) option(TILE_BUILD_BENCHMARKS "Build tests" OFF) option(TILE_WITH_OPENSSL "Build with openssl" OFF) @@ -34,34 +38,34 @@ if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release") endif() -if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -gz") - # set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -gz") - # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static") set(CMAKE_C_FLAGS - # "${CMAKE_CXX_FLAGS} -static") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} - # -fsanitize=address ") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address - # ") - - set(WHOLE_ARCHIVE_PREFIX "-Wl,-force_load") - # set(NO_WHOLE_ARCHIVE_PREFIX "") -elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") - # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -gz") - # set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -gz") - # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static") set(CMAKE_C_FLAGS - # "${CMAKE_CXX_FLAGS} -static") - - set(WHOLE_ARCHIVE_PREFIX "-Wl,-force_load,") - # set(NO_WHOLE_ARCHIVE_PREFIX "") -elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -gz") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -gz") - # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++") - # set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++") - - set(STATIC_BINARY_FLAGS "-static-libgcc -static-libstdc++") - set(WHOLE_ARCHIVE_PREFIX "-Wl,--whole-archive") - set(WHOLE_ARCHIVE_SUFFIX "-Wl,--no-whole-archive") -endif() +# if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") +# # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -gz") +# # set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -gz") +# # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static") set(CMAKE_C_FLAGS +# # "${CMAKE_CXX_FLAGS} -static") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} +# # -fsanitize=address ") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address +# # ") +# +# set(WHOLE_ARCHIVE_PREFIX "-Wl,-force_load") +# # set(NO_WHOLE_ARCHIVE_PREFIX "") +# elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") +# # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -gz") +# # set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -gz") +# # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static") set(CMAKE_C_FLAGS +# # "${CMAKE_CXX_FLAGS} -static") +# +# set(WHOLE_ARCHIVE_PREFIX "-Wl,-force_load,") +# # set(NO_WHOLE_ARCHIVE_PREFIX "") +# elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") +# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -gz") +# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -gz") +# # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++") +# # set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++") +# +# set(STATIC_BINARY_FLAGS "-static-libgcc -static-libstdc++") +# set(WHOLE_ARCHIVE_PREFIX "-Wl,--whole-archive") +# set(WHOLE_ARCHIVE_SUFFIX "-Wl,--no-whole-archive") +# endif() # extern int getifaddrs(struct ifaddrs **ifap); extern void freeifaddrs(struct # ifaddrs *ifa);