diff options
41 files changed, 215 insertions, 143 deletions
diff --git a/Help/command/configure_file.rst b/Help/command/configure_file.rst index 7fa2941..adc2a66 100644 --- a/Help/command/configure_file.rst +++ b/Help/command/configure_file.rst @@ -58,7 +58,7 @@ or #define VAR 1 Input lines of the form ``#cmakedefine01 VAR ...`` will expand -as ``#cmakedefine01 VAR ... 0`` or ``#cmakedefine01 VAR ... 0``, +as ``#cmakedefine01 VAR ... 0`` or ``#cmakedefine01 VAR ... 1``, which may lead to undefined behavior. .. versionadded:: 3.10 diff --git a/Help/guide/tutorial/Step5/CMakeLists.txt b/Help/guide/tutorial/Step5/CMakeLists.txt index a8f241a..c894917 100644 --- a/Help/guide/tutorial/Step5/CMakeLists.txt +++ b/Help/guide/tutorial/Step5/CMakeLists.txt @@ -42,7 +42,7 @@ target_include_directories(Tutorial PUBLIC # TODO 3: Install Tutorial in the bin directory # Hint: Use the TARGETS and DESTINATION parameters -# TODO 4: Install Tutorial.h to the include directory +# TODO 4: Install TutorialConfig.h to the include directory # Hint: Use the FILES and DESTINATION parameters # TODO 5: Enable testing diff --git a/Help/manual/cmake-buildsystem.7.rst b/Help/manual/cmake-buildsystem.7.rst index 9e467bf..b9d621b 100644 --- a/Help/manual/cmake-buildsystem.7.rst +++ b/Help/manual/cmake-buildsystem.7.rst @@ -1049,7 +1049,7 @@ them to a header set using the :command:`target_sources` command: add_library(Eigen INTERFACE) - target_sources(Eigen INTERFACE + target_sources(Eigen PUBLIC FILE_SET HEADERS BASE_DIRS src FILES src/eigen.h src/vector.h src/matrix.h diff --git a/Help/manual/cmake-modules.7.rst b/Help/manual/cmake-modules.7.rst index d161a28..448d8ba 100644 --- a/Help/manual/cmake-modules.7.rst +++ b/Help/manual/cmake-modules.7.rst @@ -161,7 +161,6 @@ They are normally called through the :command:`find_package` command. /module/FindICU /module/FindImageMagick /module/FindIntl - /module/FindITK /module/FindJasper /module/FindJava /module/FindJNI @@ -252,8 +251,6 @@ They are normally called through the :command:`find_package` command. /module/FindTclStub /module/FindThreads /module/FindTIFF - /module/FindUnixCommands - /module/FindVTK /module/FindVulkan /module/FindWget /module/FindWish @@ -296,9 +293,12 @@ Deprecated Find Modules :maxdepth: 1 /module/FindCUDA + /module/FindITK /module/FindPythonInterp /module/FindPythonLibs /module/FindQt + /module/FindUnixCommands + /module/FindVTK /module/FindwxWindows Legacy CPack Modules diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index dc51383..9f77562 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -876,6 +876,16 @@ Available commands are: The command now fails when the source directory does not exist. Previously it succeeded by creating an empty destination directory. +.. option:: copy_directory_if_different <dir>... <destination> + + .. versionadded:: 3.26 + + Copy changed content of ``<dir>...`` directories to ``<destination>`` directory. + If ``<destination>`` directory does not exist it will be created. + + ``copy_directory_if_different`` does follow symlinks. + The command fails when the source directory does not exist. + .. option:: copy_if_different <file>... <destination> Copy files to ``<destination>`` (either file or directory) if diff --git a/Help/prop_tgt/FOLDER.rst b/Help/prop_tgt/FOLDER.rst index f6be9e6..3155d90 100644 --- a/Help/prop_tgt/FOLDER.rst +++ b/Help/prop_tgt/FOLDER.rst @@ -11,3 +11,6 @@ separating folder levels. This property is initialized by the value of the variable :variable:`CMAKE_FOLDER` if it is set when a target is created. + +The global property :prop_gbl:`USE_FOLDERS` must be set to ON, otherwise +the ``FOLDER`` property is ignored. diff --git a/Help/release/dev/FindCUDAToolkit-arm64-sbsa.rst b/Help/release/dev/FindCUDAToolkit-arm64-sbsa.rst new file mode 100644 index 0000000..55ddb99 --- /dev/null +++ b/Help/release/dev/FindCUDAToolkit-arm64-sbsa.rst @@ -0,0 +1,4 @@ +FindCUDAToolkit-arm64-sbsa +-------------------------- + +* The :module:`FindCUDAToolkit` gained support for the `sbsa-linux` cross compilation target diff --git a/Help/release/dev/cmake-E-copy-directory-if-different.rst b/Help/release/dev/cmake-E-copy-directory-if-different.rst new file mode 100644 index 0000000..6e642c0 --- /dev/null +++ b/Help/release/dev/cmake-E-copy-directory-if-different.rst @@ -0,0 +1,4 @@ +cmake-E-copy-directory-if-different +----------------------------------- + +* The :manual:`cmake(1)` ``-E`` option learned a new ``copy_directory_if_different`` command. diff --git a/Help/release/dev/frontend-variant-always.rst b/Help/release/dev/frontend-variant-always.rst new file mode 100644 index 0000000..111175c --- /dev/null +++ b/Help/release/dev/frontend-variant-always.rst @@ -0,0 +1,6 @@ +frontend-variant-always +----------------------- + +* The :variable:`CMAKE_<LANG>_COMPILER_FRONTEND_VARIANT` variable is now + set for ``GNU``, ``MSVC``, and ``AppleClang`` compilers that have only + one frontend variant. diff --git a/Help/variable/CMAKE_LANG_COMPILER_FRONTEND_VARIANT.rst b/Help/variable/CMAKE_LANG_COMPILER_FRONTEND_VARIANT.rst index 128b1fb..a414463 100644 --- a/Help/variable/CMAKE_LANG_COMPILER_FRONTEND_VARIANT.rst +++ b/Help/variable/CMAKE_LANG_COMPILER_FRONTEND_VARIANT.rst @@ -16,3 +16,7 @@ the compiler whose frontend it resembles. .. note:: In other words, this variable describes what command line options and language extensions the compiler frontend expects. + +.. versionchanged:: 3.26 + This variable is set for ``GNU``, ``MSVC``, and ``AppleClang`` + compilers that have only one frontend variant. diff --git a/Help/variable/CMAKE_LANG_COMPILER_ID.rst b/Help/variable/CMAKE_LANG_COMPILER_ID.rst index e311d1b..3b27fc3 100644 --- a/Help/variable/CMAKE_LANG_COMPILER_ID.rst +++ b/Help/variable/CMAKE_LANG_COMPILER_ID.rst @@ -28,8 +28,8 @@ Value Name ``GHS`` `Green Hills Software`_ ``HP`` Hewlett-Packard Compiler ``IAR`` IAR Systems -``Intel`` Intel Compiler -``IntelLLVM`` Intel LLVM-Based Compiler +``Intel`` Intel Classic Compiler +``IntelLLVM`` `Intel LLVM-Based Compiler`_ ``LCC`` MCST Elbrus C/C++/Fortran Compiler ``MSVC`` `Microsoft Visual Studio`_ ``NVHPC`` `NVIDIA HPC Compiler`_ @@ -58,6 +58,7 @@ languages. .. _G95 Fortran: https://g95.sourceforge.net .. _GNU Compiler Collection: https://gcc.gnu.org .. _Green Hills Software: https://www.ghs.com/products/compiler.html +.. _Intel LLVM-Based Compiler: https://www.intel.com/content/www/us/en/developer/tools/oneapi/overview.html .. _Microsoft Visual Studio: https://visualstudio.microsoft.com .. _NVIDIA HPC Compiler: https://developer.nvidia.com/hpc-compilers .. _NVIDIA CUDA Compiler: https://developer.nvidia.com/cuda-llvm-compiler diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index fd3d028..c4ddf75 100644 --- a/Modules/CMakeDetermineCXXCompiler.cmake +++ b/Modules/CMakeDetermineCXXCompiler.cmake @@ -58,7 +58,13 @@ else() # finally list compilers to try if(NOT CMAKE_CXX_COMPILER_INIT) - set(CMAKE_CXX_COMPILER_LIST CC ${_CMAKE_TOOLCHAIN_PREFIX}c++ ${_CMAKE_TOOLCHAIN_PREFIX}g++ aCC cl bcc xlC icpx icx clang++) + set(CMAKE_CXX_COMPILER_LIST CC ${_CMAKE_TOOLCHAIN_PREFIX}c++ ${_CMAKE_TOOLCHAIN_PREFIX}g++ aCC cl bcc xlC) + if(NOT CMAKE_HOST_WIN32) + # FIXME(#24314): Add support for the GNU-like icpx compiler driver + # on Windows, first introduced by Intel oneAPI 2023.0. + list(APPEND CMAKE_CXX_COMPILER_LIST icpx) + endif() + list(APPEND CMAKE_CXX_COMPILER_LIST icx clang++) endif() _cmake_find_compiler(CXX) diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 73c775a..7f392c8 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -243,8 +243,12 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) else() set(CMAKE_${lang}_COMPILER_FRONTEND_VARIANT "GNU") endif() - elseif("x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xFujitsuClang") + elseif("x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xGNU" + OR "x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xAppleClang" + OR "x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xFujitsuClang") set(CMAKE_${lang}_COMPILER_FRONTEND_VARIANT "GNU") + elseif("x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xMSVC") + set(CMAKE_${lang}_COMPILER_FRONTEND_VARIANT "MSVC") else() set(CMAKE_${lang}_COMPILER_FRONTEND_VARIANT "") endif() diff --git a/Modules/CMakeParseImplicitIncludeInfo.cmake b/Modules/CMakeParseImplicitIncludeInfo.cmake index 5c0eda2..1ebd887 100644 --- a/Modules/CMakeParseImplicitIncludeInfo.cmake +++ b/Modules/CMakeParseImplicitIncludeInfo.cmake @@ -233,8 +233,9 @@ function(cmake_parse_implicit_include_info text lang dir_var log_var state_var) get_filename_component(dir "${d}" ABSOLUTE) list(APPEND implicit_dirs "${dir}") string(APPEND log " collapse include dir [${d}] ==> [${dir}]\n") - elseif("${d}" MATCHES [[^\.\.[\/]\.\.[\/](.*)$]]) - # This relative path is deep enough to get out of the CMakeFiles/CMakeTmp + elseif("${d}" MATCHES [[^\.\.[\/]\.\.[\/]\.\.[\/](.*)$]]) + # This relative path is deep enough to get out of the + # CMakeFiles/CMakeScratch/<unique> # directory where the ABI check is done. Assume that the compiler has # computed this path adaptively based on the current working directory # such that the effective result is absolute. diff --git a/Modules/CUDA/architectures.cmake b/Modules/CUDA/architectures.cmake index d646920..7d6a6e0 100644 --- a/Modules/CUDA/architectures.cmake +++ b/Modules/CUDA/architectures.cmake @@ -17,7 +17,7 @@ if(CMAKE_CUDA_COMPILER_TOOLKIT_VERSION VERSION_GREATER_EQUAL 9.0) endif() list(REMOVE_ITEM CMAKE_CUDA_ARCHITECTURES_ALL 20 21) - list(REMOVE_ITEM CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR 20 21) + list(REMOVE_ITEM CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR 20) endif() if(CMAKE_CUDA_COMPILER_TOOLKIT_VERSION VERSION_GREATER_EQUAL 10.0 @@ -51,6 +51,12 @@ if(CMAKE_CUDA_COMPILER_TOOLKIT_VERSION VERSION_GREATER_EQUAL 11.8 list(APPEND CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR 90) endif() +if(CMAKE_CUDA_COMPILER_TOOLKIT_VERSION VERSION_GREATER_EQUAL 12.0 + AND (NOT CMAKE_CUDA_COMPILER_ID STREQUAL "Clang")) + list(REMOVE_ITEM CMAKE_CUDA_ARCHITECTURES_ALL 35 37) + list(REMOVE_ITEM CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR 35) +endif() + # only generate jit code for the newest arch for all/all-major list(POP_BACK CMAKE_CUDA_ARCHITECTURES_ALL _latest_arch) list(TRANSFORM CMAKE_CUDA_ARCHITECTURES_ALL APPEND "-real") diff --git a/Modules/Compiler/IntelLLVM-CXX.cmake b/Modules/Compiler/IntelLLVM-CXX.cmake index cae1f11..4d3f5a1 100644 --- a/Modules/Compiler/IntelLLVM-CXX.cmake +++ b/Modules/Compiler/IntelLLVM-CXX.cmake @@ -50,8 +50,8 @@ else() set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "") set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "") - set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-Qstd=c++11") - set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-Qstd=c++11") + set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "") + set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "") set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-Qstd=c++14") set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-Qstd=c++14") diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 0cea239..72a9a4c 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -1380,7 +1380,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) set(_Boost_TIMER_DEPENDENCIES chrono) set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono atomic) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - if(Boost_VERSION_STRING VERSION_GREATER_EQUAL 1.81.0 AND NOT Boost_NO_WARN_NEW_VERSIONS) + if(Boost_VERSION_STRING VERSION_GREATER_EQUAL 1.82.0 AND NOT Boost_NO_WARN_NEW_VERSIONS) message(WARNING "New Boost version may have incorrect or missing dependencies and imported targets") endif() endif() @@ -1466,6 +1466,7 @@ function(_Boost_COMPONENT_HEADERS component _hdrs) set(_Boost_TIMER_HEADERS "boost/timer.hpp") set(_Boost_TYPE_ERASURE_HEADERS "boost/type_erasure/config.hpp") set(_Boost_UNIT_TEST_FRAMEWORK_HEADERS "boost/test/framework.hpp") + set(_Boost_URL_HEADERS "boost/url.hpp") set(_Boost_WAVE_HEADERS "boost/wave.hpp") set(_Boost_WSERIALIZATION_HEADERS "boost/archive/text_wiarchive.hpp") set(_Boost_BZIP2_HEADERS "boost/iostreams/filter/bzip2.hpp") @@ -1653,7 +1654,7 @@ else() # _Boost_COMPONENT_HEADERS. See the instructions at the top of # _Boost_COMPONENT_DEPENDENCIES. set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS} - "1.80.0" "1.80" "1.79.0" "1.79" + "1.81.0" "1.81" "1.80.0" "1.80" "1.79.0" "1.79" "1.78.0" "1.78" "1.77.0" "1.77" "1.76.0" "1.76" "1.75.0" "1.75" "1.74.0" "1.74" "1.73.0" "1.73" "1.72.0" "1.72" "1.71.0" "1.71" "1.70.0" "1.70" "1.69.0" "1.69" "1.68.0" "1.68" "1.67.0" "1.67" "1.66.0" "1.66" "1.65.1" "1.65.0" "1.65" diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake index f104bfc..d621195 100644 --- a/Modules/FindCUDAToolkit.cmake +++ b/Modules/FindCUDAToolkit.cmake @@ -795,32 +795,35 @@ endif() if(CMAKE_CROSSCOMPILING) if(CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7-a") # Support for NVPACK - set(CUDAToolkit_TARGET_NAME "armv7-linux-androideabi") + set(CUDAToolkit_TARGET_NAMES "armv7-linux-androideabi") elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm") - set(CUDAToolkit_TARGET_NAME "armv7-linux-gnueabihf") + set(CUDAToolkit_TARGET_NAMES "armv7-linux-gnueabihf") elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64") if(ANDROID_ARCH_NAME STREQUAL "arm64") - set(CUDAToolkit_TARGET_NAME "aarch64-linux-androideabi") + set(CUDAToolkit_TARGET_NAMES "aarch64-linux-androideabi") elseif (CMAKE_SYSTEM_NAME STREQUAL "QNX") - set(CUDAToolkit_TARGET_NAME "aarch64-qnx") + set(CUDAToolkit_TARGET_NAMES "aarch64-qnx") else() - set(CUDAToolkit_TARGET_NAME "aarch64-linux") - endif(ANDROID_ARCH_NAME STREQUAL "arm64") + set(CUDAToolkit_TARGET_NAMES "aarch64-linux" "sbsa-linux") + endif() elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") - set(CUDAToolkit_TARGET_NAME "x86_64-linux") + set(CUDAToolkit_TARGET_NAMES "x86_64-linux") endif() - if(EXISTS "${CUDAToolkit_ROOT_DIR}/targets/${CUDAToolkit_TARGET_NAME}") - set(CUDAToolkit_TARGET_DIR "${CUDAToolkit_ROOT_DIR}/targets/${CUDAToolkit_TARGET_NAME}") - # add known CUDA target root path to the set of directories we search for programs, libraries and headers - list(PREPEND CMAKE_FIND_ROOT_PATH "${CUDAToolkit_TARGET_DIR}") - - # Mark that we need to pop the root search path changes after we have - # found all cuda libraries so that searches for our cross-compilation - # libraries work when another cuda sdk is in CMAKE_PREFIX_PATH or - # PATh - set(_CUDAToolkit_Pop_ROOT_PATH True) - endif() + foreach(CUDAToolkit_TARGET_NAME IN LISTS CUDAToolkit_TARGET_NAMES) + if(EXISTS "${CUDAToolkit_ROOT_DIR}/targets/${CUDAToolkit_TARGET_NAME}") + set(CUDAToolkit_TARGET_DIR "${CUDAToolkit_ROOT_DIR}/targets/${CUDAToolkit_TARGET_NAME}") + # add known CUDA target root path to the set of directories we search for programs, libraries and headers + list(PREPEND CMAKE_FIND_ROOT_PATH "${CUDAToolkit_TARGET_DIR}") + + # Mark that we need to pop the root search path changes after we have + # found all cuda libraries so that searches for our cross-compilation + # libraries work when another cuda sdk is in CMAKE_PREFIX_PATH or + # PATh + set(_CUDAToolkit_Pop_ROOT_PATH True) + break() + endif() + endforeach() endif() # If not already set we can simply use the toolkit root or it's a scattered installation. @@ -1129,7 +1132,7 @@ if(CUDAToolkit_FOUND) if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 10.0) # nvToolsExt is deprecated since nvtx3 introduction. # Warn only if the project requires a sufficiently new CMake to make migration possible. - if(CMAKE_MINIMUM_REQUIRED_VERSION VERSION_GREATER_EQUAL 3.25) + if(TARGET CUDA::nvToolsExt AND CMAKE_MINIMUM_REQUIRED_VERSION VERSION_GREATER_EQUAL 3.25) set_property(TARGET CUDA::nvToolsExt PROPERTY DEPRECATION "nvToolsExt has been superseded by nvtx3 since CUDA 10.0 and CMake 3.25. Use CUDA::nvtx3 and include <nvtx3/nvToolsExt.h> instead.") endif() diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index 07a9adf..0f1e451 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -636,42 +636,26 @@ endfunction() #]=======================================================================] function(matlab_get_mex_suffix matlab_root mex_suffix) - # todo setup the extension properly. Currently I do not know if this is - # sufficient for all win32 distributions. - # there is also CMAKE_EXECUTABLE_SUFFIX that could be tweaked + # find_program does not consider script suffix .bat for Matlab mexext.bat on Windows set(mexext_suffix "") if(WIN32) - list(APPEND mexext_suffix ".bat") + set(mexext_suffix ".bat") endif() - # we first try without suffix, since cmake does not understand a list with - # one empty string element find_program( Matlab_MEXEXTENSIONS_PROG - NAMES mexext + NAMES mexext mexext${mexext_suffix} PATHS ${matlab_root}/bin DOC "Matlab MEX extension provider" NO_DEFAULT_PATH ) - foreach(current_mexext_suffix IN LISTS mexext_suffix) - if(NOT DEFINED Matlab_MEXEXTENSIONS_PROG OR NOT Matlab_MEXEXTENSIONS_PROG) - # this call should populate the cache automatically - find_program( - Matlab_MEXEXTENSIONS_PROG - "mexext${current_mexext_suffix}" - PATHS ${matlab_root}/bin - DOC "Matlab MEX extension provider" - NO_DEFAULT_PATH - ) - endif() - endforeach(current_mexext_suffix) if(MATLAB_FIND_DEBUG) message(STATUS "[MATLAB] Determining mex files extensions from '${matlab_root}/bin' with program '${Matlab_MEXEXTENSIONS_PROG}'") endif() # the program has been found? - if((NOT Matlab_MEXEXTENSIONS_PROG) OR (NOT EXISTS ${Matlab_MEXEXTENSIONS_PROG})) + if(NOT Matlab_MEXEXTENSIONS_PROG) if(MATLAB_FIND_DEBUG) message(WARNING "[MATLAB] Cannot found mexext program. Matlab root is ${matlab_root}") endif() @@ -722,7 +706,6 @@ function(matlab_get_mex_suffix matlab_root mex_suffix) message(STATUS "[MATLAB] '${Matlab_MEXEXTENSIONS_PROG}' : determined extension '${_matlab_mex_extension}' and error string is '${_matlab_mex_extension_error}'") endif() - unset(Matlab_MEXEXTENSIONS_PROG CACHE) set(${mex_suffix} ${_matlab_mex_extension} PARENT_SCOPE) endfunction() @@ -1187,7 +1170,7 @@ function(matlab_add_mex) ${${prefix}_UNPARSED_ARGUMENTS}) endif() - target_include_directories(${${prefix}_NAME} PRIVATE ${Matlab_INCLUDE_DIRS}) + target_include_directories(${${prefix}_NAME} SYSTEM PRIVATE ${Matlab_INCLUDE_DIRS}) if(NOT ${prefix}_NO_IMPLICIT_LINK_TO_MATLAB_LIBRARIES) if(Matlab_HAS_CPP_API) @@ -1763,12 +1746,24 @@ else() set(_matlab_64Build TRUE) endif() + +if(NOT DEFINED Matlab_MEX_EXTENSION) + set(_matlab_mex_extension "") + matlab_get_mex_suffix("${Matlab_ROOT_DIR}" _matlab_mex_extension) + + # This variable goes to the cache. + set(Matlab_MEX_EXTENSION ${_matlab_mex_extension} CACHE STRING "Extensions for the mex targets (automatically given by Matlab)") + unset(_matlab_mex_extension) +endif() + if(APPLE) set(_matlab_bin_prefix "mac") # i should be for intel set(_matlab_bin_suffix_32bits "i") - if(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64") + if(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64" AND Matlab_MEX_EXTENSION MATCHES "a64$") + # native Apple Silicon Matlab set(_matlab_bin_suffix_64bits "a64") else() + # Intel Mac OR Apple Silicon using Rosetta for Matlab set(_matlab_bin_suffix_64bits "i64") endif() elseif(UNIX) @@ -1812,16 +1807,6 @@ endif() unset(_matlab_64Build) -if(NOT DEFINED Matlab_MEX_EXTENSION) - set(_matlab_mex_extension "") - matlab_get_mex_suffix("${Matlab_ROOT_DIR}" _matlab_mex_extension) - - # This variable goes to the cache. - set(Matlab_MEX_EXTENSION ${_matlab_mex_extension} CACHE STRING "Extensions for the mex targets (automatically given by Matlab)") - unset(_matlab_mex_extension) -endif() - - if(MATLAB_FIND_DEBUG) message(STATUS "[MATLAB] [DEBUG]_matlab_lib_prefix_for_search = ${_matlab_lib_prefix_for_search} | _matlab_lib_dir_for_search = ${_matlab_lib_dir_for_search}") endif() diff --git a/Modules/FindUnixCommands.cmake b/Modules/FindUnixCommands.cmake index 97739fa..d71518f 100644 --- a/Modules/FindUnixCommands.cmake +++ b/Modules/FindUnixCommands.cmake @@ -5,6 +5,10 @@ FindUnixCommands ---------------- +.. deprecated:: 3.26 + + Use :option:`${CMAKE_COMMAND} -E <cmake -E>` subcommands instead. + Find Unix commands, including the ones from Cygwin This module looks for the Unix commands ``bash``, ``cp``, ``gzip``, diff --git a/Modules/FindwxWindows.cmake b/Modules/FindwxWindows.cmake index 2d46dbd..15dacbb 100644 --- a/Modules/FindwxWindows.cmake +++ b/Modules/FindwxWindows.cmake @@ -648,7 +648,7 @@ else() # set CXXFLAGS to be fed into CMAKE_CXX_FLAGS by the user: if (HAVE_ISYSTEM) # does the compiler support -isystem ? - if (NOT APPLE) # -isystem seem sto be unsuppored on Mac + if (NOT APPLE) # -isystem seems to be unsupported on Mac if(CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX ) if (CMAKE_CXX_COMPILER MATCHES g\\+\\+) set(CMAKE_WXWINDOWS_CXX_FLAGS "`${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} --cxxflags|sed -e s/-I/-isystem/g`") diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 7bfecbf..c786604 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 25) -set(CMake_VERSION_PATCH 20221230) +set(CMake_VERSION_PATCH 20230117) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index a39c52f..643bc6f 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -165,7 +165,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) if (outstring) { *outstring = "--build-and-test requires that the generator " "be provided using the --build-generator " - "command line option. "; + "command line option.\n"; } return 1; } diff --git a/Source/CTest/cmCTestCurl.cxx b/Source/CTest/cmCTestCurl.cxx index 69c5793..84161f9 100644 --- a/Source/CTest/cmCTestCurl.cxx +++ b/Source/CTest/cmCTestCurl.cxx @@ -112,7 +112,7 @@ bool cmCTestCurl::UploadFile(std::string const& local_file, { response.clear(); if (!this->InitCurl()) { - cmCTestLog(this->CTest, ERROR_MESSAGE, "Initialization of curl failed"); + cmCTestLog(this->CTest, ERROR_MESSAGE, "Initialization of curl failed\n"); return false; } /* enable uploading */ @@ -176,7 +176,7 @@ bool cmCTestCurl::UploadFile(std::string const& local_file, if (response.empty()) { cmCTestLog(this->CTest, ERROR_MESSAGE, "No response from server.\n" - << curlDebug); + << curlDebug << std::endl); return false; } return true; @@ -192,7 +192,7 @@ bool cmCTestCurl::HttpRequest(std::string const& url, << "fields " << fields << "\n", this->Quiet); if (!this->InitCurl()) { - cmCTestLog(this->CTest, ERROR_MESSAGE, "Initialization of curl failed"); + cmCTestLog(this->CTest, ERROR_MESSAGE, "Initialization of curl failed\n"); return false; } curl_easy_setopt(this->Curl, CURLOPT_POST, 1); diff --git a/Source/CTest/cmCTestGenericHandler.cxx b/Source/CTest/cmCTestGenericHandler.cxx index 1c292c7..dd69968 100644 --- a/Source/CTest/cmCTestGenericHandler.cxx +++ b/Source/CTest/cmCTestGenericHandler.cxx @@ -26,13 +26,8 @@ namespace { * is non-null, otherwise removing key `op` (if it exists). */ void SetMapValue(cmCTestGenericHandler::t_StringToString& map, - const std::string& op, const char* value) + const std::string& op, const std::string& value) { - if (!value) { - map.erase(op); - return; - } - map[op] = value; } void SetMapValue(cmCTestGenericHandler::t_StringToString& map, @@ -47,7 +42,8 @@ void SetMapValue(cmCTestGenericHandler::t_StringToString& map, } } -void cmCTestGenericHandler::SetOption(const std::string& op, const char* value) +void cmCTestGenericHandler::SetOption(const std::string& op, + const std::string& value) { SetMapValue(this->Options, op, value); } @@ -57,7 +53,7 @@ void cmCTestGenericHandler::SetOption(const std::string& op, cmValue value) } void cmCTestGenericHandler::SetPersistentOption(const std::string& op, - const char* value) + const std::string& value) { this->SetOption(op, value); SetMapValue(this->PersistentOptions, op, value); @@ -121,7 +117,7 @@ bool cmCTestGenericHandler::StartResultingXML(cmCTest::Part part, if (!name) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot create resulting XML file without providing the name" - << std::endl;); + << std::endl); return false; } std::ostringstream ostr; @@ -157,7 +153,7 @@ bool cmCTestGenericHandler::StartLogFile(const char* name, if (!name) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot create log file without providing the name" - << std::endl;); + << std::endl); return false; } std::ostringstream ostr; diff --git a/Source/CTest/cmCTestGenericHandler.h b/Source/CTest/cmCTestGenericHandler.h index 4bdb9c2..a0197d6 100644 --- a/Source/CTest/cmCTestGenericHandler.h +++ b/Source/CTest/cmCTestGenericHandler.h @@ -85,17 +85,9 @@ public: * so calling a single-getter for a key that has only been set * as a multi-value will return nullptr. */ - void SetPersistentOption(const std::string& op, const char* value); - void SetPersistentOption(const std::string& op, const std::string& value) - { - this->SetPersistentOption(op, cmValue(value)); - } + void SetPersistentOption(const std::string& op, const std::string& value); void SetPersistentOption(const std::string& op, cmValue value); - void SetOption(const std::string& op, const char* value); - void SetOption(const std::string& op, const std::string& value) - { - this->SetOption(op, cmValue(value)); - } + void SetOption(const std::string& op, const std::string& value); void SetOption(const std::string& op, cmValue value); cmValue GetOption(const std::string& op); diff --git a/Source/CTest/cmCTestHandlerCommand.cxx b/Source/CTest/cmCTestHandlerCommand.cxx index be952cd..c377d68 100644 --- a/Source/CTest/cmCTestHandlerCommand.cxx +++ b/Source/CTest/cmCTestHandlerCommand.cxx @@ -143,7 +143,7 @@ bool cmCTestHandlerCommand::InitialPass(std::vector<std::string> const& args, "BuildDirectory", cmSystemTools::CollapseFullPath(bdir), this->Quiet); } else { cmCTestLog(this->CTest, ERROR_MESSAGE, - "CTEST_BINARY_DIRECTORY not set" << std::endl;); + "CTEST_BINARY_DIRECTORY not set" << std::endl); } } if (!this->Source.empty()) { @@ -164,7 +164,7 @@ bool cmCTestHandlerCommand::InitialPass(std::vector<std::string> const& args, this->CTest->SetCTestConfiguration("ChangeId", *changeId, this->Quiet); } - cmCTestLog(this->CTest, DEBUG, "Initialize handler" << std::endl;); + cmCTestLog(this->CTest, DEBUG, "Initialize handler" << std::endl); cmCTestGenericHandler* handler = this->InitializeHandler(); if (!handler) { cmCTestLog(this->CTest, ERROR_MESSAGE, diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 41c05e2..72cd8cd 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -411,7 +411,8 @@ cmCTest::Part cmCTest::GetPartFromName(const std::string& name) return PartCount; } -int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command) +int cmCTest::Initialize(const std::string& binary_dir, + cmCTestStartCommand* command) { bool quiet = false; if (command && command->ShouldBeQuiet()) { @@ -684,7 +685,7 @@ bool cmCTest::InitializeFromCommand(cmCTestStartCommand* command) this->SetCTestConfigurationFromCMakeVariable( mf, "BuildName", "CTEST_BUILD_NAME", command->ShouldBeQuiet()); - if (!this->Initialize(bld_dir.c_str(), command)) { + if (!this->Initialize(bld_dir, command)) { return false; } cmCTestOptionalLog(this, OUTPUT, @@ -944,8 +945,7 @@ int cmCTest::ProcessSteps() (this->GetRemainingTimeAllowed() > std::chrono::minutes(2))) { cmCTestUpdateHandler* uphandler = this->GetUpdateHandler(); uphandler->SetPersistentOption( - "SourceDirectory", - this->GetCTestConfiguration("SourceDirectory").c_str()); + "SourceDirectory", this->GetCTestConfiguration("SourceDirectory")); update_count = uphandler->ProcessHandler(); if (update_count < 0) { res |= cmCTest::UPDATE_ERRORS; @@ -1692,7 +1692,7 @@ bool cmCTest::SubmitExtraFiles(std::vector<std::string> const& files) if (!cmSystemTools::FileExists(file)) { cmCTestLog(this, ERROR_MESSAGE, "Cannot find extra file: " << file << " to submit." - << std::endl;); + << std::endl); return false; } this->AddSubmitFile(PartExtraFiles, file); @@ -2141,9 +2141,9 @@ bool cmCTest::HandleCommandLineArguments(size_t& i, i < args.size() - 1) { i++; this->GetTestHandler()->SetPersistentOption("TestsToRunInformation", - args[i].c_str()); + args[i]); this->GetMemCheckHandler()->SetPersistentOption("TestsToRunInformation", - args[i].c_str()); + args[i]); } else if (this->CheckArgument(arg, "-U"_s, "--union")) { this->GetTestHandler()->SetPersistentOption("UseUnion", "true"); this->GetMemCheckHandler()->SetPersistentOption("UseUnion", "true"); @@ -2151,9 +2151,9 @@ bool cmCTest::HandleCommandLineArguments(size_t& i, i < args.size() - 1) { i++; this->GetTestHandler()->SetPersistentOption("IncludeRegularExpression", - args[i].c_str()); + args[i]); this->GetMemCheckHandler()->SetPersistentOption("IncludeRegularExpression", - args[i].c_str()); + args[i]); } else if (this->CheckArgument(arg, "-L"_s, "--label-regex") && i < args.size() - 1) { i++; @@ -2174,41 +2174,40 @@ bool cmCTest::HandleCommandLineArguments(size_t& i, i < args.size() - 1) { i++; this->GetTestHandler()->SetPersistentOption("ExcludeRegularExpression", - args[i].c_str()); + args[i]); this->GetMemCheckHandler()->SetPersistentOption("ExcludeRegularExpression", - args[i].c_str()); + args[i]); } else if (this->CheckArgument(arg, "-FA"_s, "--fixture-exclude-any") && i < args.size() - 1) { i++; this->GetTestHandler()->SetPersistentOption( - "ExcludeFixtureRegularExpression", args[i].c_str()); + "ExcludeFixtureRegularExpression", args[i]); this->GetMemCheckHandler()->SetPersistentOption( - "ExcludeFixtureRegularExpression", args[i].c_str()); + "ExcludeFixtureRegularExpression", args[i]); } else if (this->CheckArgument(arg, "-FS"_s, "--fixture-exclude-setup") && i < args.size() - 1) { i++; this->GetTestHandler()->SetPersistentOption( - "ExcludeFixtureSetupRegularExpression", args[i].c_str()); + "ExcludeFixtureSetupRegularExpression", args[i]); this->GetMemCheckHandler()->SetPersistentOption( - "ExcludeFixtureSetupRegularExpression", args[i].c_str()); + "ExcludeFixtureSetupRegularExpression", args[i]); } else if (this->CheckArgument(arg, "-FC"_s, "--fixture-exclude-cleanup") && i < args.size() - 1) { i++; this->GetTestHandler()->SetPersistentOption( - "ExcludeFixtureCleanupRegularExpression", args[i].c_str()); + "ExcludeFixtureCleanupRegularExpression", args[i]); this->GetMemCheckHandler()->SetPersistentOption( - "ExcludeFixtureCleanupRegularExpression", args[i].c_str()); + "ExcludeFixtureCleanupRegularExpression", args[i]); } else if (this->CheckArgument(arg, "--resource-spec-file"_s) && i < args.size() - 1) { i++; - this->GetTestHandler()->SetPersistentOption("ResourceSpecFile", - args[i].c_str()); + this->GetTestHandler()->SetPersistentOption("ResourceSpecFile", args[i]); this->GetMemCheckHandler()->SetPersistentOption("ResourceSpecFile", - args[i].c_str()); + args[i]); } else if (this->CheckArgument(arg, "--rerun-failed"_s)) { @@ -2316,8 +2315,8 @@ void cmCTest::SetPersistentOptionIfNotEmpty(const std::string& value, const std::string& optionName) { if (!value.empty()) { - this->GetTestHandler()->SetPersistentOption(optionName, value.c_str()); - this->GetMemCheckHandler()->SetPersistentOption(optionName, value.c_str()); + this->GetTestHandler()->SetPersistentOption(optionName, value); + this->GetMemCheckHandler()->SetPersistentOption(optionName, value); } } @@ -2760,8 +2759,9 @@ int cmCTest::Run(std::vector<std::string>& args, std::string* output) // intended for (auto& handler : this->Impl->GetTestingHandlers()) { if (!handler->ProcessCommandLineArguments(arg, i, args)) { - cmCTestLog(this, ERROR_MESSAGE, - "Problem parsing command line arguments within a handler"); + cmCTestLog( + this, ERROR_MESSAGE, + "Problem parsing command line arguments within a handler\n"); return 0; } } @@ -2923,7 +2923,7 @@ int cmCTest::ExecuteTests() } } - if (!this->Initialize(workDir.c_str(), nullptr)) { + if (!this->Initialize(workDir, nullptr)) { res = 12; cmCTestLog(this, ERROR_MESSAGE, "Problem initializing the dashboard." << std::endl); diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 0017b3e..9a8d5a6 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -481,7 +481,7 @@ private: * call this method because it sets CTEST_COMMAND to drive a build * through the ctest command line. */ - int Initialize(const char* binary_dir, cmCTestStartCommand* command); + int Initialize(const std::string& binary_dir, cmCTestStartCommand* command); /** parse the option after -D and convert it into the appropriate steps */ bool AddTestsForDashboardType(std::string& targ); diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 25a0e2d..2a4ea80 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -7,6 +7,7 @@ #include <cstring> #include <set> #include <sstream> +#include <type_traits> #include <utility> #include <cm/string_view> @@ -1131,7 +1132,7 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode( result.VariableCached = !arguments.NoCache; result.Output = std::move(output); result.ExitCode = res; - return result; + return cm::optional<cmTryCompileResult>(std::move(result)); } bool cmCoreTryCompile::IsTemporary(std::string const& path) diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx index 86c9679..ef59c32 100644 --- a/Source/cmTryRunCommand.cxx +++ b/Source/cmTryRunCommand.cxx @@ -86,11 +86,12 @@ public: std::string* runOutputStdOutContents, std::string* runOutputStdErrContents); void DoNotRunExecutable(const std::string& runArgs, - const std::string& srcFile, + cm::optional<std::string> const& srcFile, std::string const& compileResultVariable, std::string* runOutputContents, std::string* runOutputStdOutContents, - std::string* runOutputStdErrContents); + std::string* runOutputStdErrContents, + bool stdOutErrRequired); bool NoCache; std::string RunResultVariable; @@ -185,12 +186,17 @@ bool TryRunCommandImpl::TryRunCode(std::vector<std::string> const& argv) std::string runOutputStdErrContents; if (this->Makefile->IsOn("CMAKE_CROSSCOMPILING") && !this->Makefile->IsDefinitionSet("CMAKE_CROSSCOMPILING_EMULATOR")) { + // We only require the stdout/stderr cache entries if the project + // actually asked for the values, not just for logging. + bool const stdOutErrRequired = (arguments.RunOutputStdOutVariable || + arguments.RunOutputStdErrVariable); this->DoNotRunExecutable( - runArgs, *arguments.SourceDirectoryOrFile, + runArgs, arguments.SourceDirectoryOrFile, *arguments.CompileResultVariable, captureRunOutput ? &runOutputContents : nullptr, captureRunOutputStdOutErr ? &runOutputStdOutContents : nullptr, - captureRunOutputStdOutErr ? &runOutputStdErrContents : nullptr); + captureRunOutputStdOutErr ? &runOutputStdErrContents : nullptr, + stdOutErrRequired); } else { this->RunExecutable( runArgs, arguments.RunWorkingDirectory, @@ -309,9 +315,9 @@ void TryRunCommandImpl::RunExecutable(const std::string& runArgs, the executable would have produced. */ void TryRunCommandImpl::DoNotRunExecutable( - const std::string& runArgs, const std::string& srcFile, + const std::string& runArgs, cm::optional<std::string> const& srcFile, std::string const& compileResultVariable, std::string* out, - std::string* stdOut, std::string* stdErr) + std::string* stdOut, std::string* stdErr, bool stdOutErrRequired) { // copy the executable out of the CMakeFiles/ directory, so it is not // removed at the end of try_run() and the user can run it manually @@ -357,7 +363,7 @@ void TryRunCommandImpl::DoNotRunExecutable( } // is the output from the executable used ? - if (stdOut || stdErr) { + if (stdOutErrRequired) { if (!this->Makefile->GetDefinition(internalRunOutputStdOutName)) { // if the variables doesn't exist, create it with a helpful error text // and mark it as advanced @@ -492,9 +498,11 @@ void TryRunCommandImpl::DoNotRunExecutable( comment += "The "; comment += compileResultVariable; - comment += " variable holds the build result for this try_run().\n\n" - "Source file : "; - comment += srcFile + "\n"; + comment += " variable holds the build result for this try_run().\n\n"; + if (srcFile) { + comment += "Source file : "; + comment += *srcFile + "\n"; + } comment += "Executable : "; comment += copyDest + "\n"; comment += "Run arguments : "; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 1f45ce3..9734414 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -3867,6 +3867,8 @@ bool cmVisualStudio10TargetGenerator::ComputeMasmOptions( this->LocalGenerator->AddLanguageFlags(flags, this->GeneratorTarget, cmBuildStep::Compile, "ASM_MASM", configName); + this->LocalGenerator->AddCompileOptions(flags, this->GeneratorTarget, + "ASM_MASM", configName); masmOptions.Parse(flags); diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 4303f96..21d0cc9 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -110,6 +110,8 @@ void CMakeCommandUsage(std::string const& program) "(either file or directory)\n" << " copy_directory <dir>... destination - copy content of <dir>... " "directories to 'destination' directory\n" + << " copy_directory_if_different <dir>... destination - copy changed content of <dir>... " + "directories to 'destination' directory\n" << " copy_if_different <file>... destination - copy files if it has " "changed\n" << " echo [<string>...] - displays arguments as text\n" @@ -731,12 +733,15 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args, return return_value; } - // Copy directory content - if (args[1] == "copy_directory" && args.size() > 3) { + // Copy directory contents + if ((args[1] == "copy_directory" || + args[1] == "copy_directory_if_different") && + args.size() > 3) { // If error occurs we want to continue copying next files. bool return_value = false; + const bool copy_always = (args[1] == "copy_directory"); for (auto const& arg : cmMakeRange(args).advance(2).retreat(1)) { - if (!cmSystemTools::CopyADirectory(arg, args.back())) { + if (!cmSystemTools::CopyADirectory(arg, args.back(), copy_always)) { std::cerr << "Error copying directory from \"" << arg << "\" to \"" << args.back() << "\".\n"; return_value = true; diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 480ad09..f48e845 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -594,6 +594,15 @@ unset(in) unset(out) set(in ${RunCMake_SOURCE_DIR}/copy_input) +set(out ${RunCMake_BINARY_DIR}/copy_directory_different_output) +file(REMOVE_RECURSE "${out}") +file(MAKE_DIRECTORY ${out}) +run_cmake_command(E_copy_directory_if_different + ${CMAKE_COMMAND} -E copy_directory_if_different ${in} ${out}) +unset(in) +unset(out) + +set(in ${RunCMake_SOURCE_DIR}/copy_input) set(out ${RunCMake_BINARY_DIR}/copy_directory_output) set(outfile ${out}/file_for_test.txt) file(REMOVE_RECURSE "${out}") diff --git a/Tests/RunCMake/ParseImplicitData/hand-C-relative.input b/Tests/RunCMake/ParseImplicitData/hand-C-relative.input index 52ac9df..dd0c10b 100644 --- a/Tests/RunCMake/ParseImplicitData/hand-C-relative.input +++ b/Tests/RunCMake/ParseImplicitData/hand-C-relative.input @@ -16,8 +16,8 @@ This is a hand-written test case. #include "..." search starts here: #include <...> search starts here: /usr/local/include - ../../../adaptive/relative/include + ../../../../adaptive/relative/include /usr/include End of search list. -/usr/bin/ld -L/usr/lib64 -L../../../adaptive/relative/lib +/usr/bin/ld -L/usr/lib64 -L../../../../adaptive/relative/lib diff --git a/Tests/RunCMake/ParseImplicitData/hand-CXX-relative.input b/Tests/RunCMake/ParseImplicitData/hand-CXX-relative.input index 0b223a1..568933a 100644 --- a/Tests/RunCMake/ParseImplicitData/hand-CXX-relative.input +++ b/Tests/RunCMake/ParseImplicitData/hand-CXX-relative.input @@ -16,8 +16,8 @@ This is a hand-written test case. #include "..." search starts here: #include <...> search starts here: /usr/local/include - ../../../adaptive/relative/include + ../../../../adaptive/relative/include /usr/include End of search list. -/usr/bin/ld -L/usr/lib64 -L../../../adaptive/relative/lib +/usr/bin/ld -L/usr/lib64 -L../../../../adaptive/relative/lib diff --git a/Tests/RunCMake/try_run/CrossCompile.cmake b/Tests/RunCMake/try_run/CrossCompile.cmake new file mode 100644 index 0000000..4993768 --- /dev/null +++ b/Tests/RunCMake/try_run/CrossCompile.cmake @@ -0,0 +1,8 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) + +# Pretend we are cross-compiling to take that try_run code path. +set(CMAKE_CROSSCOMPILING 1) +set(RUN_RESULT 0) +try_run(RUN_RESULT COMPILE_RESULT ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c) +unset(CMAKE_CROSSCOMPILING) diff --git a/Tests/RunCMake/try_run/old_and_new_signature_tests.cmake b/Tests/RunCMake/try_run/old_and_new_signature_tests.cmake index e1c1784..2b51eb2 100644 --- a/Tests/RunCMake/try_run/old_and_new_signature_tests.cmake +++ b/Tests/RunCMake/try_run/old_and_new_signature_tests.cmake @@ -11,6 +11,8 @@ run_cmake(BadLinkLibraries) run_cmake(BinDirEmpty) run_cmake(BinDirRelative) +run_cmake(CrossCompile) + run_cmake(WorkingDirArg) run_cmake(NoCompileOutputVariable) diff --git a/Tests/VSMASM/CMakeLists.txt b/Tests/VSMASM/CMakeLists.txt index 603a43b..49bd24a 100644 --- a/Tests/VSMASM/CMakeLists.txt +++ b/Tests/VSMASM/CMakeLists.txt @@ -8,3 +8,5 @@ else() endif() include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) add_executable(VSMASM main.c foo.asm) +target_compile_definitions(VSMASM PUBLIC DEF_FOO) +target_compile_options(VSMASM PUBLIC -DDEF_BAR) diff --git a/Tests/VSMASM/foo.asm b/Tests/VSMASM/foo.asm index 51cb969..97bdd1a 100644 --- a/Tests/VSMASM/foo.asm +++ b/Tests/VSMASM/foo.asm @@ -1,3 +1,9 @@ +ifndef DEF_FOO +.err <DEF_FOO incorrectly not defined> +endif +ifndef DEF_BAR +.err <DEF_BAR incorrectly not defined> +endif ifndef TESTx64 .386 .model flat, c diff --git a/Utilities/cmzlib/cm_zlib_mangle.h b/Utilities/cmzlib/cm_zlib_mangle.h index 1461e2f..d75405d 100644 --- a/Utilities/cmzlib/cm_zlib_mangle.h +++ b/Utilities/cmzlib/cm_zlib_mangle.h @@ -19,7 +19,7 @@ # define compress2 cm_zlib_compress2 # define compressBound cm_zlib_compressBound #endif -#define crc32 z_crc32 +#define crc32 cm_zlib_crc32 #define crc32_combine cm_zlib_crc32_combine #define crc32_combine64 cm_zlib_crc32_combine64 #define crc32_z cm_zlib_crc32_z @@ -126,7 +126,6 @@ #define crc32_combine_gen cm_zlib_crc32_combine_gen #define crc32_combine_op cm_zlib_crc32_combine_op #define gz_error cm_zlib_gz_error -#define z_crc32 cm_zlib_z_crc32 #define z_errmsg cm_zlib_z_errmsg #endif |