diff options
author | Brad King <brad.king@kitware.com> | 2019-01-31 16:10:44 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-01-31 16:12:27 (GMT) |
commit | 24bee427b5da710c5f9941f5cddb455df1a2ea82 (patch) | |
tree | eaf06b65ad4bc8ab9e31b389f2317265b0a1e6af | |
parent | 9aef4a732ba6b0d20c9953d171514fa4c0daaddf (diff) | |
parent | a37614667d2a1d7d3e4db5e1ec8df644bfbe39fa (diff) | |
download | CMake-24bee427b5da710c5f9941f5cddb455df1a2ea82.zip CMake-24bee427b5da710c5f9941f5cddb455df1a2ea82.tar.gz CMake-24bee427b5da710c5f9941f5cddb455df1a2ea82.tar.bz2 |
Merge topic 'update-kwsys'
a37614667d Configure KWSys to honor CMake_NO_CXX_STANDARD
e3b26f0004 Merge branch 'upstream-KWSys' into update-kwsys
c22e373a30 KWSys 2019-01-30 (ce89cada)
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2886
-rw-r--r-- | CMakeLists.txt | 3 | ||||
-rw-r--r-- | Source/kwsys/CMakeLists.txt | 25 | ||||
-rw-r--r-- | Source/kwsys/kwsysPlatformTests.cmake | 5 |
3 files changed, 23 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 75a0b52..bd130ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -332,6 +332,9 @@ macro (CMAKE_BUILD_UTILITIES) set(KWSYS_USE_ConsoleBuf 1) set(KWSYS_HEADER_ROOT ${CMake_BINARY_DIR}/Source) set(KWSYS_INSTALL_DOC_DIR "${CMAKE_DOC_DIR}") + if(CMake_NO_CXX_STANDARD) + set(KWSYS_CXX_STANDARD "") + endif() add_subdirectory(Source/kwsys) set(kwsys_folder "Utilities/KWSys") CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE} "${kwsys_folder}") diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt index b33aa80..e7da994 100644 --- a/Source/kwsys/CMakeLists.txt +++ b/Source/kwsys/CMakeLists.txt @@ -42,6 +42,10 @@ # SET(KWSYS_HEADER_ROOT ${PROJECT_BINARY_DIR}) # INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR}) # +# KWSYS_CXX_STANDARD = A value for CMAKE_CXX_STANDARD within KWSys. +# Set to empty string to use no default value. +# KWSYS_CXX_COMPILE_FEATURES = target_compile_features arguments for KWSys. +# # Optional settings to setup install rules are as follows: # # KWSYS_INSTALL_BIN_DIR = The installation target directories into @@ -82,25 +86,17 @@ # any outside mailing list and no documentation of the change will be # written. -CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3 FATAL_ERROR) +CMAKE_MINIMUM_REQUIRED(VERSION 3.1 FATAL_ERROR) FOREACH(p - CMP0022 # CMake 2.8, Define link interface - required by android_mk export - CMP0025 # CMake 3.0, Compiler id for Apple Clang is now AppleClang. - CMP0042 # CMake 3.0, MACOSX_RPATH is enabled by default. - CMP0048 # CMake 3.0, Let the project command manage version variables. CMP0056 # CMake 3.2, Honor link flags in try_compile() source-file signature. CMP0063 # CMake 3.3, Honor visibility properties for all target types. + CMP0067 # CMake 3.8, Honor language standard in try_compile source-file signature. CMP0069 # CMake 3.9, INTERPROCEDURAL_OPTIMIZATION is enforced when enabled. ) IF(POLICY ${p}) CMAKE_POLICY(SET ${p} NEW) ENDIF() ENDFOREACH() -SET(CMAKE_LEGACY_CYGWIN_WIN32 0) - -IF(CMAKE_VERSION VERSION_LESS 3.0) - SET(KWSYS_SPLIT_OBJECTS_FROM_INTERFACE 0) -ENDIF() #----------------------------------------------------------------------------- # If a namespace is not specified, use "kwsys" and enable testing. @@ -121,6 +117,12 @@ SET_PROPERTY(DIRECTORY "KWSYS_HEADER(%)=<${KWSYS_NAMESPACE}/%>" ) +if(KWSYS_CXX_STANDARD) + set(CMAKE_CXX_STANDARD "${KWSYS_CXX_STANDARD}") +elseif(NOT DEFINED CMAKE_CXX_STANDARD AND NOT DEFINED KWSYS_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 11) +endif() + # Select library components. IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) SET(KWSYS_ENABLE_C 1) @@ -884,6 +886,8 @@ IF(KWSYS_C_SRCS OR KWSYS_CXX_SRCS) ${KWSYS_TARGET_INTERFACE}) TARGET_SOURCES(${KWSYS_TARGET_LINK} INTERFACE $<TARGET_OBJECTS:${KWSYS_TARGET_OBJECT}>) + target_compile_features(${KWSYS_TARGET_OBJECT} PRIVATE ${KWSYS_CXX_COMPILE_FEATURES}) + target_compile_features(${KWSYS_TARGET_INTERFACE} INTERFACE ${KWSYS_CXX_COMPILE_FEATURES}) ELSE() SET(KWSYS_TARGET_INTERFACE ${KWSYS_NAMESPACE}) SET(KWSYS_TARGET_OBJECT ${KWSYS_NAMESPACE}) @@ -892,6 +896,7 @@ IF(KWSYS_C_SRCS OR KWSYS_CXX_SRCS) SET(KWSYS_LINK_DEPENDENCY PUBLIC) ADD_LIBRARY(${KWSYS_TARGET_INTERFACE} ${KWSYS_LIBRARY_TYPE} ${KWSYS_C_SRCS} ${KWSYS_CXX_SRCS}) + target_compile_features(${KWSYS_TARGET_INTERFACE} PUBLIC ${KWSYS_CXX_COMPILE_FEATURES}) ENDIF() if (KWSYS_ALIAS_TARGET) add_library(${KWSYS_ALIAS_TARGET} ALIAS ${KWSYS_TARGET_INTERFACE}) diff --git a/Source/kwsys/kwsysPlatformTests.cmake b/Source/kwsys/kwsysPlatformTests.cmake index 5386a49..28d3f68 100644 --- a/Source/kwsys/kwsysPlatformTests.cmake +++ b/Source/kwsys/kwsysPlatformTests.cmake @@ -7,11 +7,16 @@ SET(KWSYS_PLATFORM_TEST_FILE_CXX kwsysPlatformTestsCXX.cxx) MACRO(KWSYS_PLATFORM_TEST lang var description invert) IF(NOT DEFINED ${var}_COMPILED) MESSAGE(STATUS "${description}") + set(maybe_cxx_standard "") + if(CMAKE_VERSION VERSION_LESS 3.8 AND CMAKE_CXX_STANDARD) + set(maybe_cxx_standard "-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}") + endif() TRY_COMPILE(${var}_COMPILED ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${KWSYS_PLATFORM_TEST_FILE_${lang}} COMPILE_DEFINITIONS -DTEST_${var} ${KWSYS_PLATFORM_TEST_DEFINES} ${KWSYS_PLATFORM_TEST_EXTRA_FLAGS} CMAKE_FLAGS "-DLINK_LIBRARIES:STRING=${KWSYS_PLATFORM_TEST_LINK_LIBRARIES}" + ${maybe_cxx_standard} OUTPUT_VARIABLE OUTPUT) IF(${var}_COMPILED) FILE(APPEND |