From 60460c9c5ea399e2f9422bfa1fc941587058f1fc Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Tue, 3 Dec 2019 13:05:02 -0600 Subject: [PATCH] build: Pass -Wl,--no-undefined when linking --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4781e1ccc..3dc130f5f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -170,6 +170,11 @@ endif() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Wextra -Wno-unused-parameter") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-unused-parameter") +if(NOT MSVC) + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined") + set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined") +endif() + # Default to PIC code set(CMAKE_POSITION_INDEPENDENT_CODE ON)