Skip to content

Commit

Permalink
Merge pull request #2296 from ben-clayton/err-unresolved
Browse files Browse the repository at this point in the history
CMake: Error on unresolved symbols
  • Loading branch information
johnkslang authored Jun 30, 2020
2 parents dca4706 + 1fee607 commit 90f1d6a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "9.0.0")
add_compile_options(-Werror=deprecated-copy)
endif()

# Error if there's symbols that are not found at link time.
add_link_options("-Wl,--no-undefined")
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" AND NOT MSVC)
add_compile_options(-Wall -Wuninitialized -Wunused -Wunused-local-typedefs
-Wunused-parameter -Wunused-value -Wunused-variable)
Expand All @@ -138,6 +141,9 @@ elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" AND NOT MSVC)
if(NOT ENABLE_EXCEPTIONS)
add_compile_options(-fno-exceptions)
endif()

# Error if there's symbols that are not found at link time.
add_link_options("-Wl,-undefined,error")
elseif(MSVC)
if(NOT ENABLE_RTTI)
string(FIND "${CMAKE_CXX_FLAGS}" "/GR" MSVC_HAS_GR)
Expand Down

0 comments on commit 90f1d6a

Please sign in to comment.