Unverified Commit 90f1d6ab by John Kessenich Committed by GitHub

Merge pull request #2296 from ben-clayton/err-unresolved

CMake: Error on unresolved symbols
parents dca47063 1fee6072
...@@ -128,6 +128,9 @@ if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU") ...@@ -128,6 +128,9 @@ if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "9.0.0") if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "9.0.0")
add_compile_options(-Werror=deprecated-copy) add_compile_options(-Werror=deprecated-copy)
endif() 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) elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" AND NOT MSVC)
add_compile_options(-Wall -Wuninitialized -Wunused -Wunused-local-typedefs add_compile_options(-Wall -Wuninitialized -Wunused -Wunused-local-typedefs
-Wunused-parameter -Wunused-value -Wunused-variable) -Wunused-parameter -Wunused-value -Wunused-variable)
...@@ -138,6 +141,9 @@ elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" AND NOT MSVC) ...@@ -138,6 +141,9 @@ elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" AND NOT MSVC)
if(NOT ENABLE_EXCEPTIONS) if(NOT ENABLE_EXCEPTIONS)
add_compile_options(-fno-exceptions) add_compile_options(-fno-exceptions)
endif() endif()
# Error if there's symbols that are not found at link time.
add_link_options("-Wl,-undefined,error")
elseif(MSVC) elseif(MSVC)
if(NOT ENABLE_RTTI) if(NOT ENABLE_RTTI)
string(FIND "${CMAKE_CXX_FLAGS}" "/GR" MSVC_HAS_GR) string(FIND "${CMAKE_CXX_FLAGS}" "/GR" MSVC_HAS_GR)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment