1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 02:08:27 +08:00

KWSys 2025-03-25 (6a109a7b)

Code extracted from:

    https://gitlab.kitware.com/utils/kwsys.git

at commit 6a109a7b7e7985b39d7dc22c6515888b2921cf90 (master).

Upstream Shortlog
-----------------

Brad King (2):
      a3f10d75 Drop unused code for compatibility with CMake < 2.6
      f555ff3a Require CMake 3.13 or higher, enable policies through 3.31

Peter Kokot (2):
      03be1fd7 Replace CMAKE_COMPILER_IS_GNUCXX with CMAKE_CXX_COMPILER_ID
      1a2e54be CTest: Replace deprecated TEST_INCLUDE_FILE with TEST_INCLUDE_FILES
This commit is contained in:
KWSys Upstream
2025-03-25 09:35:50 -04:00
committed by Brad King
parent 25ea535aba
commit 7bf8891b88
2 changed files with 36 additions and 41 deletions

View File

@@ -88,7 +88,7 @@
# any outside mailing list and no documentation of the change will be
# written.
cmake_minimum_required(VERSION 3.9...3.22 FATAL_ERROR)
cmake_minimum_required(VERSION 3.13...3.31 FATAL_ERROR)
# Some configure checks depend upon the deployment target. Clear checks when
# the deployment target changes.
@@ -317,7 +317,7 @@ endif()
#-----------------------------------------------------------------------------
# Adjust compiler flags for some platforms.
if(NOT CMAKE_COMPILER_IS_GNUCXX)
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(CMAKE_SYSTEM MATCHES "OSF1-V.*")
string(REGEX MATCH "-timplicit_local"
KWSYS_CXX_FLAGS_HAVE_IMPLICIT_LOCAL "${CMAKE_CXX_FLAGS}")
@@ -1038,7 +1038,7 @@ if(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
if(CTEST_TEST_KWSYS)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/ExtraTest.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/ExtraTest.cmake")
set_directory_properties(PROPERTIES TEST_INCLUDE_FILE "${CMAKE_CURRENT_BINARY_DIR}/ExtraTest.cmake")
set_property(DIRECTORY APPEND PROPERTY TEST_INCLUDE_FILES "${CMAKE_CURRENT_BINARY_DIR}/ExtraTest.cmake")
endif()
set(KWSYS_TEST_ARGS_testCommandLineArguments

View File

@@ -171,51 +171,46 @@ endmacro()
#
# Compile test named by ${var} and store INFO strings extracted from binary.
macro(KWSYS_PLATFORM_INFO_TEST lang var description)
# We can implement this macro on CMake 2.6 and above.
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.6)
set(${var} "")
else()
# Choose a location for the result binary.
set(KWSYS_PLATFORM_INFO_FILE
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/${var}.bin)
# Choose a location for the result binary.
set(KWSYS_PLATFORM_INFO_FILE
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/${var}.bin)
# Compile the test binary.
if(NOT EXISTS ${KWSYS_PLATFORM_INFO_FILE})
message(STATUS "${description}")
try_compile(${var}_COMPILED
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/${KWSYS_PLATFORM_TEST_FILE_${lang}}
COMPILE_DEFINITIONS -DTEST_${var}
${KWSYS_PLATFORM_${lang}_TEST_DEFINES}
${KWSYS_PLATFORM_${lang}_TEST_EXTRA_FLAGS}
OUTPUT_VARIABLE OUTPUT
COPY_FILE ${KWSYS_PLATFORM_INFO_FILE}
)
if(CMAKE_VERSION VERSION_LESS 3.26)
if(${var}_COMPILED)
file(APPEND
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"${description} compiled with the following output:\n${OUTPUT}\n\n")
else()
file(APPEND
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"${description} failed to compile with the following output:\n${OUTPUT}\n\n")
endif()
endif()
# Compile the test binary.
if(NOT EXISTS ${KWSYS_PLATFORM_INFO_FILE})
message(STATUS "${description}")
try_compile(${var}_COMPILED
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/${KWSYS_PLATFORM_TEST_FILE_${lang}}
COMPILE_DEFINITIONS -DTEST_${var}
${KWSYS_PLATFORM_${lang}_TEST_DEFINES}
${KWSYS_PLATFORM_${lang}_TEST_EXTRA_FLAGS}
OUTPUT_VARIABLE OUTPUT
COPY_FILE ${KWSYS_PLATFORM_INFO_FILE}
)
if(CMAKE_VERSION VERSION_LESS 3.26)
if(${var}_COMPILED)
message(STATUS "${description} - compiled")
file(APPEND
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"${description} compiled with the following output:\n${OUTPUT}\n\n")
else()
message(STATUS "${description} - failed")
file(APPEND
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"${description} failed to compile with the following output:\n${OUTPUT}\n\n")
endif()
endif()
# Parse info strings out of the compiled binary.
if(${var}_COMPILED)
file(STRINGS ${KWSYS_PLATFORM_INFO_FILE} ${var} REGEX "INFO:[A-Za-z0-9]+\\[[^]]*\\]")
message(STATUS "${description} - compiled")
else()
set(${var} "")
message(STATUS "${description} - failed")
endif()
set(KWSYS_PLATFORM_INFO_FILE)
endif()
# Parse info strings out of the compiled binary.
if(${var}_COMPILED)
file(STRINGS ${KWSYS_PLATFORM_INFO_FILE} ${var} REGEX "INFO:[A-Za-z0-9]+\\[[^]]*\\]")
else()
set(${var} "")
endif()
set(KWSYS_PLATFORM_INFO_FILE)
endmacro()