Skip to content

Commit

Permalink
build: build with -Wl,--no-undefined
Browse files Browse the repository at this point in the history
This should make updating submodules much more straightforward.
  • Loading branch information
nemequ committed Oct 31, 2015
1 parent df073d2 commit e3e906e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ include (ExtraWarningFlags)
include (CheckFunctionExists)
include (CheckIncludeFile)
include (AddCompilerFlags)
include (NoUndefined)

enable_testing ()

Expand Down
14 changes: 14 additions & 0 deletions cmake/NoUndefined.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# This adds -Wl,--no-undefined (if it works). It should help identify
# issues, especially when updating submodules.

include (CheckCCompilerFlag)

set (OLD_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
set (CMAKE_REQUIRED_FLAGS "-Wl,--no-undefined")
check_c_compiler_flag ("" CFLAG_Wl___no_undefined)
if (CFLAG_Wl___no_undefined)
set (CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_SHARED_LINKER_FLAGS}")
set (CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_MODULE_LINKER_FLAGS}")
set (CMAKE_EXE_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_EXE_LINKER_FLAGS}")
endif ()
set (CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")

0 comments on commit e3e906e

Please sign in to comment.