From 968c01162e935d994e6a55cb09b7089332af8608 Mon Sep 17 00:00:00 2001 From: Will Date: Sun, 27 Oct 2024 20:54:55 -0400 Subject: [PATCH] build/cmake: do not optimize away our entire library --- CMakeLists.txt | 7 +++++-- libwatcher-c.version | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 libwatcher-c.version diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f4a78e..d6c4f08 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -94,7 +94,6 @@ if(NOT WIN32 AND NOT IS_CC_MSVC) set(COMPILE_OPTIONS "${COMPILE_OPTIONS}" "-fexpensive-optimizations" - "-fwhole-program" ) endif() endif() @@ -187,7 +186,11 @@ function(wtr_add_bin_target include(GNUInstallDirs) add_executable("${NAME}" "${SRC_SET}") set_property(TARGET "${NAME}" PROPERTY CXX_STANDARD "${WTR_WATCHER_CXX_STD}") - target_compile_options("${NAME}" PRIVATE "${CC_OPT_SET}") + if(NOT WIN32 AND NOT IS_CC_MSVC AND NOT IS_CC_APPLECLANG) + target_compile_options("${NAME}" PRIVATE "${CC_OPT_SET};-fwhole-program") + else() + target_compile_options("${NAME}" PRIVATE "${CC_OPT_SET}") + endif() target_link_options("${NAME}" PRIVATE "${LL_OPT_SET}") target_include_directories("${NAME}" PUBLIC "${INCLUDE_PATH}") target_link_libraries("${NAME}" PRIVATE "${LLIB_SET}") diff --git a/libwatcher-c.version b/libwatcher-c.version new file mode 100644 index 0000000..6fe0302 --- /dev/null +++ b/libwatcher-c.version @@ -0,0 +1,4 @@ +WATCHER_C { + global: wtr_* ; WTR_* ; + local: _Z* ; +};