Skip to content

Commit

Permalink
build/cmake: do not optimize away our entire library
Browse files Browse the repository at this point in the history
  • Loading branch information
Will committed Oct 28, 2024
1 parent e7d43b9 commit 968c011
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ if(NOT WIN32 AND NOT IS_CC_MSVC)
set(COMPILE_OPTIONS
"${COMPILE_OPTIONS}"
"-fexpensive-optimizations"
"-fwhole-program"
)
endif()
endif()
Expand Down Expand Up @@ -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}")
Expand Down
4 changes: 4 additions & 0 deletions libwatcher-c.version
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
WATCHER_C {
global: wtr_* ; WTR_* ;
local: _Z* ;
};

0 comments on commit 968c011

Please sign in to comment.