Merge pull request #3294 from bmiklautz/misc_build

Misc build and test fixes
This commit is contained in:
Norbert Federa 2016-04-19 15:32:56 +02:00
commit 8110435b90
3 changed files with 18 additions and 16 deletions

View File

@ -193,21 +193,6 @@ if(CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations")
endif()
if (DEFINED CMAKE_REQUIRED_FLAGS)
set(SAVE_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
endif()
set(CMAKE_REQUIRED_FLAGS "-Wl,--no-undefined")
CHECK_C_COMPILER_FLAG (-Wl,--no-undefined no-undefined)
if (DEFINED SAVE_CMAKE_REQUIRED_FLAGS)
set(CMAKE_REQUIRED_FLAGS ${SAVE_CMAKE_REQUIRED_FLAGS})
unset(SAVE_CMAKE_REQUIRED_FLAGS)
else()
unset(CMAKE_REQUIRED_FLAGS)
endif()
if(no-undefined)
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined" )
endif()
if(NOT EXPORT_ALL_SYMBOLS)
message(STATUS "GCC default symbol visibility: hidden")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
@ -292,6 +277,22 @@ if(${CMAKE_C_COMPILER_ID} STREQUAL "Clang" OR CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-omit-frame-pointer")
endif()
endif()
if (WITH_NO_UNDEFINED)
if (DEFINED CMAKE_REQUIRED_FLAGS)
set(SAVE_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
endif()
set(CMAKE_REQUIRED_FLAGS "-Wl,--no-undefined")
CHECK_C_COMPILER_FLAG (-Wl,--no-undefined no-undefined)
if (DEFINED SAVE_CMAKE_REQUIRED_FLAGS)
set(CMAKE_REQUIRED_FLAGS ${SAVE_CMAKE_REQUIRED_FLAGS})
unset(SAVE_CMAKE_REQUIRED_FLAGS)
else()
unset(CMAKE_REQUIRED_FLAGS)
endif()
if(no-undefined)
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined" )
endif()
endif()
endif()
if(MSVC)

View File

@ -45,3 +45,4 @@ set (WITH_DEBUG_X11_CLIPRDR OFF CACHE BOOL "enable debug")
set (WITH_DEBUG_X11_LOCAL_MOVESIZE OFF CACHE BOOL "enable debug")
set (WITH_DEBUG_XV OFF CACHE BOOL "enable debug")
set (WITH_SAMPLE ON CACHE BOOL "samples")
set (WITH_NO_UNDEFINED ON CACHE BOOL "don't link with undefined symbols")

View File

@ -56,7 +56,7 @@ endif()
option(WITH_SMARTCARD_INSPECT "Enable SmartCard API Inspector" OFF)
option(BUILD_TESTING "Build unit tests" OFF)
CMAKE_DEPENDENT_OPTION(TESTS_WTSAPI_EXTRA "Build extra WTSAPI tests (interactive)" OFF "BUILD_TESTING" ON)
CMAKE_DEPENDENT_OPTION(TESTS_WTSAPI_EXTRA "Build extra WTSAPI tests (interactive)" OFF "BUILD_TESTING" OFF)
option(WITH_SAMPLE "Build sample code" OFF)