diff options
150 files changed, 1264 insertions, 438 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5982c27..c13ba72 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1392,6 +1392,20 @@ t:windows-openwatcom1.9: variables: CMAKE_CI_JOB_NIGHTLY: "true" +t:windows-orangec6.73.1: + extends: + - .windows_orangec6.73.1 + - .cmake_test_windows_external + - .windows_x86_64_tags_concurrent + - .cmake_junit_artifacts + - .run_dependent + dependencies: + - t:windows-vs2022-x64-ninja + needs: + - t:windows-vs2022-x64-ninja + variables: + CMAKE_CI_JOB_NIGHTLY: "true" + # Windows arm64 jobs b:windows-arm64-vs2022-ninja: diff --git a/.gitlab/.gitignore b/.gitlab/.gitignore index 852dfa6..19796ef 100644 --- a/.gitlab/.gitignore +++ b/.gitlab/.gitignore @@ -12,6 +12,7 @@ /ninja* /openmp /open-watcom* +/orangec /python* /qt* /sccache* diff --git a/.gitlab/ci/configure_windows_orangec6.73.1.cmake b/.gitlab/ci/configure_windows_orangec6.73.1.cmake new file mode 100644 index 0000000..e667b94 --- /dev/null +++ b/.gitlab/ci/configure_windows_orangec6.73.1.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_LIST_DIR}/configure_windows_orangec_common.cmake") diff --git a/.gitlab/ci/configure_windows_orangec_common.cmake b/.gitlab/ci/configure_windows_orangec_common.cmake new file mode 100644 index 0000000..55dce1d --- /dev/null +++ b/.gitlab/ci/configure_windows_orangec_common.cmake @@ -0,0 +1,5 @@ +set(CMake_TEST_Java OFF CACHE BOOL "") + +set(configure_no_sccache 1) + +include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake") diff --git a/.gitlab/ci/env_windows_orangec6.73.1.ps1 b/.gitlab/ci/env_windows_orangec6.73.1.ps1 new file mode 100755 index 0000000..96e36a1 --- /dev/null +++ b/.gitlab/ci/env_windows_orangec6.73.1.ps1 @@ -0,0 +1,2 @@ +. .gitlab/ci/ninja-env.ps1 +. .gitlab/ci/orangec-env.ps1 diff --git a/.gitlab/ci/orangec-env.ps1 b/.gitlab/ci/orangec-env.ps1 new file mode 100755 index 0000000..3a5d232 --- /dev/null +++ b/.gitlab/ci/orangec-env.ps1 @@ -0,0 +1,8 @@ +Invoke-Expression -Command .gitlab/ci/orangec.ps1 +$pwdpath = $pwd.Path +Set-Item -Force -Path "env:PATH" -Value "$pwdpath\.gitlab\orangec\bin;$env:PATH" +Set-Item -Force -Path "env:ORANGEC" -Value "$pwdpath\.gitlab\orangec" + +$env:CC = "occ" +$env:CXX = "occ" +occ --version diff --git a/.gitlab/ci/orangec.ps1 b/.gitlab/ci/orangec.ps1 new file mode 100755 index 0000000..2201e12 --- /dev/null +++ b/.gitlab/ci/orangec.ps1 @@ -0,0 +1,24 @@ +$erroractionpreference = "stop" + +if ("$env:CMAKE_CONFIGURATION".Contains("orangec6.73.1")) { + # OrangeC 6.73.1 + $archive = "ZippedBinaries6738.zip" + $release = "Orange-C-v6.73.1" + $sha256sum = "29BC506AB105B2BF1002129C37826B2153DF1C8D0F22B9A2C38ACA3FB72A5B89" +} else { + throw ('unknown CMAKE_CONFIGURATION: ' + "$env:CMAKE_CONFIGURATION") +} + +$outdir = $pwd.Path +$outdir = "$outdir\.gitlab" +$ProgressPreference = 'SilentlyContinue' +Invoke-WebRequest -Uri "https://github.com/LADSoft/OrangeC/releases/download/$release/$archive" -OutFile "$outdir\$archive" +$hash = Get-FileHash "$outdir\$archive" -Algorithm SHA256 +if ($hash.Hash -ne $sha256sum) { + exit 1 +} + +Add-Type -AssemblyName System.IO.Compression.FileSystem +[System.IO.Compression.ZipFile]::ExtractToDirectory("$outdir\$archive", "$outdir") +# The archive contains directory 'orangec', placed at '$outdir\orangec'. +Remove-Item "$outdir\$archive" diff --git a/.gitlab/os-macos.yml b/.gitlab/os-macos.yml index 9212ecc..b3165fa 100644 --- a/.gitlab/os-macos.yml +++ b/.gitlab/os-macos.yml @@ -7,7 +7,7 @@ GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci ext/$CI_CONCURRENT_ID" # TODO: Factor this out so that each job selects the Xcode version to # use so that different versions can be tested in a single pipeline. - DEVELOPER_DIR: "/Applications/Xcode-14.3.app/Contents/Developer" + DEVELOPER_DIR: "/Applications/Xcode-15.0.app/Contents/Developer" # Avoid conflicting with other projects running on the same machine. SCCACHE_SERVER_PORT: 4227 @@ -135,7 +135,7 @@ - cmake # Since this is a bare runner, pin to a project. - macos-x86_64 - shell - - xcode-14.3 + - xcode-15.0 - nonconcurrent .macos_x86_64_tags_ext: @@ -143,7 +143,7 @@ - cmake # Since this is a bare runner, pin to a project. - macos-x86_64 - shell - - xcode-14.3 + - xcode-15.0 - concurrent .macos_arm64_tags: @@ -151,7 +151,7 @@ - cmake # Since this is a bare runner, pin to a project. - macos-arm64 - shell - - xcode-14.3 + - xcode-15.0 - nonconcurrent .macos_arm64_tags_ext: @@ -159,7 +159,7 @@ - cmake # Since this is a bare runner, pin to a project. - macos-arm64 - shell - - xcode-14.3 + - xcode-15.0 - concurrent .macos_arm64_tags_package: @@ -167,7 +167,7 @@ - cmake # Since this is a bare runner, pin to a project. - macos-arm64 - shell - - xcode-14.3 + - xcode-15.0 - nonconcurrent - finder diff --git a/.gitlab/os-windows.yml b/.gitlab/os-windows.yml index 81944cb..c449ab8 100644 --- a/.gitlab/os-windows.yml +++ b/.gitlab/os-windows.yml @@ -261,6 +261,20 @@ variables: CMAKE_CONFIGURATION: windows_openwatcom1.9 +.windows_orangec: + extends: .windows + + variables: + CMAKE_GENERATOR: "Ninja" + CMAKE_CI_BUILD_TYPE: Release + CMAKE_CI_NIGHTLY_IGNORE_DEPS: "true" + +.windows_orangec6.73.1: + extends: .windows_orangec + + variables: + CMAKE_CONFIGURATION: windows_orangec6.73.1 + .windows_arm64_vs2022: extends: .windows diff --git a/Help/envvar/CUDAHOSTCXX.rst b/Help/envvar/CUDAHOSTCXX.rst index 74f5d48..4e78afa 100644 --- a/Help/envvar/CUDAHOSTCXX.rst +++ b/Help/envvar/CUDAHOSTCXX.rst @@ -8,8 +8,10 @@ CUDAHOSTCXX Preferred executable for compiling host code when compiling ``CUDA`` language files. Will only be used by CMake on the first configuration to determine ``CUDA`` host compiler, after which the value for ``CUDAHOSTCXX`` is -stored in the cache as :variable:`CMAKE_CUDA_HOST_COMPILER`. This environment -variable is preferred over :variable:`CMAKE_CUDA_HOST_COMPILER`. +stored in the cache as +:variable:`CMAKE_CUDA_HOST_COMPILER <CMAKE_<LANG>_HOST_COMPILER>`. +This environment variable is preferred over +:variable:`CMAKE_CUDA_HOST_COMPILER <CMAKE_<LANG>_HOST_COMPILER>`. This environment variable is primarily meant for use with projects that enable ``CUDA`` as a first-class language. diff --git a/Help/envvar/HIPHOSTCXX.rst b/Help/envvar/HIPHOSTCXX.rst new file mode 100644 index 0000000..871fbfb --- /dev/null +++ b/Help/envvar/HIPHOSTCXX.rst @@ -0,0 +1,19 @@ +HIPHOSTCXX +----------- + +.. versionadded:: 3.28 + +.. include:: ENV_VAR.txt + +Preferred executable for compiling host code when compiling ``HIP`` +language files with the NVIDIA CUDA Compiler. Will only be used by CMake +on the first configuration to determine ``HIP`` host compiler, after which +the value for ``HIPHOSTCXX`` is stored in the cache as +:variable:`CMAKE_HIP_HOST_COMPILER <CMAKE_<LANG>_HOST_COMPILER>`. + +This environment variable is primarily meant for use with projects that +enable ``HIP`` as a first-class language. + +.. note:: + + Ignored when using :ref:`Visual Studio Generators`. diff --git a/Help/manual/OPTIONS_BUILD.txt b/Help/manual/OPTIONS_BUILD.txt index 94adac8..fb1e7d4 100644 --- a/Help/manual/OPTIONS_BUILD.txt +++ b/Help/manual/OPTIONS_BUILD.txt @@ -105,11 +105,15 @@ .. option:: --toolchain <path-to-file> + .. versionadded:: 3.21 + Specify the cross compiling toolchain file, equivalent to setting :variable:`CMAKE_TOOLCHAIN_FILE` variable. .. option:: --install-prefix <directory> + .. versionadded:: 3.21 + Specify the installation directory, used by the :variable:`CMAKE_INSTALL_PREFIX` variable. Must be an absolute path. diff --git a/Help/manual/cmake-env-variables.7.rst b/Help/manual/cmake-env-variables.7.rst index 356e73d..55f07b7 100644 --- a/Help/manual/cmake-env-variables.7.rst +++ b/Help/manual/cmake-env-variables.7.rst @@ -84,6 +84,7 @@ Environment Variables for Languages /envvar/FFLAGS /envvar/HIPCXX /envvar/HIPFLAGS + /envvar/HIPHOSTCXX /envvar/ISPC /envvar/ISPCFLAGS /envvar/OBJC diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index 86ae0a4..00d1aa4 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -195,6 +195,12 @@ Two forms of conditional generator expressions are supported: if ``condition`` is ``0``. Any other value for ``condition`` results in an error. + .. versionadded:: 3.28 + + This generator expression short-circuits such that generator expressions in + ``false_string`` will not evaluate when ``condition`` is ``1``, and generator + expressions in ``true_string`` will not evaluate when condition is ``0``. + Typically, the ``condition`` is itself a generator expression. For instance, the following expression expands to ``DEBUG_MODE`` when the ``Debug`` configuration is used, and the empty string for all other configurations: @@ -252,6 +258,11 @@ The common boolean logic operators are supported: ``condition`` must be ``0`` or ``1``. The result of the expression is ``0`` if ``condition`` is ``1``, else ``1``. + .. versionadded:: 3.28 + + Logical operators short-circuit such that generator expressions in the + arguments list will not be evaluated once a return value can be determined. + .. _`Comparison Expressions`: Primary Comparison Expressions diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 536046a..d9df773 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -628,6 +628,7 @@ Variables for Languages /variable/CMAKE_LANG_FLAGS_RELEASE_INIT /variable/CMAKE_LANG_FLAGS_RELWITHDEBINFO /variable/CMAKE_LANG_FLAGS_RELWITHDEBINFO_INIT + /variable/CMAKE_LANG_HOST_COMPILER /variable/CMAKE_LANG_IGNORE_EXTENSIONS /variable/CMAKE_LANG_IMPLICIT_INCLUDE_DIRECTORIES /variable/CMAKE_LANG_IMPLICIT_LINK_DIRECTORIES diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index b5848f7..5223acb 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -309,6 +309,8 @@ Options .. option:: --debug-find + .. versionadded:: 3.17 + Put cmake find commands in a debug mode. Print extra find call information during the cmake run to standard @@ -318,6 +320,8 @@ Options .. option:: --debug-find-pkg=<pkg>[,...] + .. versionadded:: 3.23 + Put cmake find commands in a debug mode when running under calls to :command:`find_package(\<pkg\>) <find_package>`, where ``<pkg>`` is an entry in the given comma-separated list of case-sensitive package @@ -328,6 +332,8 @@ Options .. option:: --debug-find-var=<var>[,...] + .. versionadded:: 3.23 + Put cmake find commands in a debug mode when called with ``<var>`` as the result variable, where ``<var>`` is an entry in the given comma-separated list. @@ -349,6 +355,8 @@ Options .. option:: --trace-format=<format> + .. versionadded:: 3.17 + Put cmake in trace mode and sets the trace output format. ``<format>`` can be one of the following values. @@ -471,12 +479,16 @@ Options .. option:: --compile-no-warning-as-error + .. versionadded:: 3.24 + Ignore target property :prop_tgt:`COMPILE_WARNING_AS_ERROR` and variable :variable:`CMAKE_COMPILE_WARNING_AS_ERROR`, preventing warnings from being treated as errors on compile. .. option:: --profiling-output=<path> + .. versionadded:: 3.18 + Used in conjunction with :option:`--profiling-format <cmake --profiling-format>` to output to a given path. @@ -1325,6 +1337,8 @@ autoconf-based projects (via ``share/aclocal/cmake.m4``). Run a Workflow Preset ===================== +.. versionadded:: 3.25 + .. program:: cmake :manual:`CMake Presets <cmake-presets(7)>` provides a way to execute multiple diff --git a/Help/release/dev/FetchContent-exclude-from-all.rst b/Help/release/dev/FetchContent-exclude-from-all.rst new file mode 100644 index 0000000..267ce72 --- /dev/null +++ b/Help/release/dev/FetchContent-exclude-from-all.rst @@ -0,0 +1,7 @@ +FetchContent-exclude-from-all +----------------------------- + +* The :module:`FetchContent` module's :command:`FetchContent_Declare` command + gained an ``EXCLUDE_FROM_ALL`` option, which propagates through to the + :command:`add_subdirectory` call made by + :command:`FetchContent_MakeAvailable` for the dependency. diff --git a/Help/release/dev/genexp-no-eval.rst b/Help/release/dev/genexp-no-eval.rst new file mode 100644 index 0000000..42ff1aa --- /dev/null +++ b/Help/release/dev/genexp-no-eval.rst @@ -0,0 +1,5 @@ +genexp-no-eval +-------------- + +* :manual:`generator expressions <cmake-generator-expressions(7)>` + short-circuit to avoid unnecessary evaluation of parameters. diff --git a/Help/release/dev/orangec-compiler.rst b/Help/release/dev/orangec-compiler.rst new file mode 100644 index 0000000..9068699 --- /dev/null +++ b/Help/release/dev/orangec-compiler.rst @@ -0,0 +1,5 @@ +orangec-compiler +---------------- + +* The OrangeC compiler is now supported with + :variable:`compiler id <CMAKE_<LANG>_COMPILER_ID>` ``OrangeC``. diff --git a/Help/variable/CMAKE_CUDA_HOST_COMPILER.rst b/Help/variable/CMAKE_CUDA_HOST_COMPILER.rst index 6e2d756..498e2e5 100644 --- a/Help/variable/CMAKE_CUDA_HOST_COMPILER.rst +++ b/Help/variable/CMAKE_CUDA_HOST_COMPILER.rst @@ -3,34 +3,6 @@ CMAKE_CUDA_HOST_COMPILER .. versionadded:: 3.10 -When :variable:`CMAKE_CUDA_COMPILER_ID <CMAKE_<LANG>_COMPILER_ID>` is -``NVIDIA``, ``CMAKE_CUDA_HOST_COMPILER`` selects the compiler executable to use -when compiling host code for ``CUDA`` language files. -This maps to the ``nvcc -ccbin`` option. - -The ``CMAKE_CUDA_HOST_COMPILER`` variable may be set explicitly before CUDA is -first enabled by a :command:`project` or :command:`enable_language` command. -This can be done via ``-DCMAKE_CUDA_HOST_COMPILER=...`` on the command line -or in a :ref:`toolchain file <Cross Compiling Toolchain>`. Or, one may set -the :envvar:`CUDAHOSTCXX` environment variable to provide a default value. - -Once the CUDA language is enabled, the ``CMAKE_CUDA_HOST_COMPILER`` variable -is read-only and changes to it are undefined behavior. - -.. note:: - - Since ``CMAKE_CUDA_HOST_COMPILER`` is meaningful only when the - :variable:`CMAKE_CUDA_COMPILER_ID <CMAKE_<LANG>_COMPILER_ID>` is ``NVIDIA``, - it does not make sense to set ``CMAKE_CUDA_HOST_COMPILER`` without also - setting ``CMAKE_CUDA_COMPILER`` to NVCC. - -.. note:: - - Projects should not try to set ``CMAKE_CUDA_HOST_COMPILER`` to match - :variable:`CMAKE_CXX_COMPILER <CMAKE_<LANG>_COMPILER>` themselves. - It is the end-user's responsibility, not the project's, to ensure that - the C++ and CUDA compilers target the same ABI. - -.. note:: - - Ignored when using :ref:`Visual Studio Generators`. +This is the original CUDA-specific name for the more general +:variable:`CMAKE_<LANG>_HOST_COMPILER` variable. See the latter +for details. diff --git a/Help/variable/CMAKE_EXPORT_COMPILE_COMMANDS.rst b/Help/variable/CMAKE_EXPORT_COMPILE_COMMANDS.rst index a7e9029..2e7f7c4 100644 --- a/Help/variable/CMAKE_EXPORT_COMPILE_COMMANDS.rst +++ b/Help/variable/CMAKE_EXPORT_COMPILE_COMMANDS.rst @@ -15,7 +15,8 @@ form. The format of the JSON file looks like: { "directory": "/home/user/development/project", "command": "/usr/bin/c++ ... -c ../foo/foo.cc", - "file": "../foo/foo.cc" + "file": "../foo/foo.cc", + "output": "../foo.dir/foo.cc.o" }, ... @@ -23,7 +24,8 @@ form. The format of the JSON file looks like: { "directory": "/home/user/development/project", "command": "/usr/bin/c++ ... -c ../foo/bar.cc", - "file": "../foo/bar.cc" + "file": "../foo/bar.cc", + "output": "../foo.dir/bar.cc.o" } ] diff --git a/Help/variable/CMAKE_LANG_COMPILER_ID.rst b/Help/variable/CMAKE_LANG_COMPILER_ID.rst index c89b3ab..6893eea 100644 --- a/Help/variable/CMAKE_LANG_COMPILER_ID.rst +++ b/Help/variable/CMAKE_LANG_COMPILER_ID.rst @@ -35,6 +35,7 @@ Value Name ``MSVC`` `Microsoft Visual Studio`_ ``NVHPC`` `NVIDIA HPC Compiler`_ ``NVIDIA`` `NVIDIA CUDA Compiler`_ +``OrangeC`` `OrangeC Compiler`_ ``OpenWatcom`` `Open Watcom`_ ``PGI`` The Portland Group ``PathScale`` PathScale @@ -63,6 +64,7 @@ languages. .. _NVIDIA HPC Compiler: https://developer.nvidia.com/hpc-compilers .. _NVIDIA CUDA Compiler: https://developer.nvidia.com/cuda-llvm-compiler .. _Open Watcom: https://open-watcom.github.io +.. _OrangeC Compiler: https://github.com/LADSoft/OrangeC .. _Small Device C Compiler: https://sdcc.sourceforge.net .. _Tiny C Compiler: https://bellard.org/tcc .. _Tasking Compiler Toolsets: https://www.tasking.com diff --git a/Help/variable/CMAKE_LANG_HOST_COMPILER.rst b/Help/variable/CMAKE_LANG_HOST_COMPILER.rst new file mode 100644 index 0000000..cf3ba62 --- /dev/null +++ b/Help/variable/CMAKE_LANG_HOST_COMPILER.rst @@ -0,0 +1,44 @@ +CMAKE_<LANG>_HOST_COMPILER +-------------------------- + +.. versionadded:: 3.10 + ``CMAKE_CUDA_HOST_COMPILER`` + +.. versionadded:: 3.28 + ``CMAKE_HIP_HOST_COMPILER`` + +This variable is available when ``<LANG>`` is ``CUDA`` or ``HIP``. + +When :variable:`CMAKE_<LANG>_COMPILER_ID` is +``NVIDIA``, ``CMAKE_<LANG>_HOST_COMPILER`` selects the compiler executable +to use when compiling host code for ``CUDA`` or ``HIP`` language files. +This maps to the ``nvcc -ccbin`` option. + +The ``CMAKE_<LANG>_HOST_COMPILER`` variable may be set explicitly before CUDA +or HIP is first enabled by a :command:`project` or :command:`enable_language` +command. +This can be done via ``-DCMAKE_<LANG>_HOST_COMPILER=...`` on the command line +or in a :ref:`toolchain file <Cross Compiling Toolchain>`. Or, one may set +the :envvar:`CUDAHOSTCXX` or :envvar:`HIPHOSTCXX` environment variable to +provide a default value. + +Once the CUDA or HIP language is enabled, the ``CMAKE_<LANG>_HOST_COMPILER`` +variable is read-only and changes to it are undefined behavior. + +.. note:: + + Since ``CMAKE_<LANG>_HOST_COMPILER`` is meaningful only when the + :variable:`CMAKE_<LANG>_COMPILER_ID` is ``NVIDIA``, + it does not make sense to set ``CMAKE_<LANG>_HOST_COMPILER`` without also + setting ``CMAKE_<LANG>_COMPILER`` to NVCC. + +.. note:: + + Projects should not try to set ``CMAKE_<LANG>_HOST_COMPILER`` to match + :variable:`CMAKE_CXX_COMPILER <CMAKE_<LANG>_COMPILER>` themselves. + It is the end-user's responsibility, not the project's, to ensure that + NVCC targets the same ABI as the C++ compiler. + +.. note:: + + Ignored when using :ref:`Visual Studio Generators`. diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake index 3a2b51f..7eb93e2 100644 --- a/Modules/CMakeCompilerIdDetection.cmake +++ b/Modules/CMakeCompilerIdDetection.cmake @@ -72,6 +72,7 @@ function(compiler_id_detection outvar lang) Fujitsu GHS Tasking + OrangeC ) if ("x${lang}" STREQUAL "xC") list(APPEND ordered_compilers diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake index 8ec6c66..6d7d17e 100644 --- a/Modules/CMakeDetermineASMCompiler.cmake +++ b/Modules/CMakeDetermineASMCompiler.cmake @@ -70,6 +70,10 @@ if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_ARMClang "--version") set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_ARMClang "armclang") + list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS OrangeC ) + set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_OrangeC "--version") + set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_OrangeC "occ \\(OrangeC\\) Version") + list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS HP ) set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_HP "-V") set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_HP "HP C") diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake index 13bfeec..7d8fa19 100644 --- a/Modules/CMakeDetermineCompilerABI.cmake +++ b/Modules/CMakeDetermineCompilerABI.cmake @@ -26,13 +26,13 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src) if(DEFINED CMAKE_${lang}_VERBOSE_COMPILE_FLAG) set(COMPILE_DEFINITIONS "${CMAKE_${lang}_VERBOSE_COMPILE_FLAG}") endif() - if(lang STREQUAL "CUDA") - if(CMAKE_CUDA_ARCHITECTURES STREQUAL "native") + if(lang MATCHES "^(CUDA|HIP)$") + if(CMAKE_${lang}_ARCHITECTURES STREQUAL "native") # We are about to detect the native architectures, so we do # not yet know them. Use all architectures during detection. - set(CMAKE_CUDA_ARCHITECTURES "all") + set(CMAKE_${lang}_ARCHITECTURES "all") endif() - set(CMAKE_CUDA_RUNTIME_LIBRARY "Static") + set(CMAKE_${lang}_RUNTIME_LIBRARY "Static") endif() if(NOT "x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xMSVC") # Avoid adding our own platform standard libraries for compilers diff --git a/Modules/CMakeDetermineHIPCompiler.cmake b/Modules/CMakeDetermineHIPCompiler.cmake index 21322f1..e667099 100644 --- a/Modules/CMakeDetermineHIPCompiler.cmake +++ b/Modules/CMakeDetermineHIPCompiler.cmake @@ -5,8 +5,8 @@ include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake) include(${CMAKE_ROOT}/Modules/CMakeParseImplicitLinkInfo.cmake) include(${CMAKE_ROOT}/Modules/CMakeParseLibraryArchitecture.cmake) -if( NOT ( ("${CMAKE_GENERATOR}" MATCHES "Make") OR - ("${CMAKE_GENERATOR}" MATCHES "Ninja") ) ) +if(NOT ((CMAKE_GENERATOR MATCHES "Make") OR + (CMAKE_GENERATOR MATCHES "Ninja"))) message(FATAL_ERROR "HIP language not currently supported by \"${CMAKE_GENERATOR}\" generator") endif() @@ -107,6 +107,13 @@ if(NOT CMAKE_HIP_COMPILER_ID_RUN) # If the user set CMAKE_HIP_ARCHITECTURES, validate its value. include(Internal/CMakeCUDAArchitecturesValidate) cmake_cuda_architectures_validate(HIP) + + if(NOT CMAKE_HIP_HOST_COMPILER AND NOT $ENV{HIPHOSTCXX} STREQUAL "") + get_filename_component(CMAKE_HIP_HOST_COMPILER $ENV{HIPHOSTCXX} PROGRAM) + if(NOT EXISTS "${CMAKE_HIP_HOST_COMPILER}") + message(FATAL_ERROR "Could not find compiler set in environment variable HIPHOSTCXX:\n$ENV{HIPHOSTCXX}.\n${CMAKE_HIP_HOST_COMPILER}") + endif() + endif() endif() if(CMAKE_HIP_COMPILER_ID STREQUAL "Clang") @@ -114,6 +121,9 @@ if(NOT CMAKE_HIP_COMPILER_ID_RUN) elseif(CMAKE_HIP_COMPILER_ID STREQUAL "NVIDIA") # Tell nvcc to treat .hip files as CUDA sources. list(APPEND CMAKE_HIP_COMPILER_ID_TEST_FLAGS_FIRST "-x cu -v") + if(CMAKE_HIP_HOST_COMPILER) + string(APPEND CMAKE_HIP_COMPILER_ID_TEST_FLAGS_FIRST " -ccbin=\"${CMAKE_HIP_HOST_COMPILER}\"") + endif() endif() # We perform compiler identification for a second time to extract implicit linking info. @@ -164,57 +174,61 @@ if(NOT CMAKE_HIP_COMPILER_ROCM_ROOT) message(FATAL_ERROR "Failed to find ROCm root directory.") endif() -# Normally implicit link information is not detected until ABI detection, -# but we need to populate CMAKE_HIP_LIBRARY_ARCHITECTURE to find hip-lang. -cmake_parse_implicit_link_info("${CMAKE_HIP_COMPILER_PRODUCED_OUTPUT}" - _CMAKE_HIP_COMPILER_ID_IMPLICIT_LIBS - _CMAKE_HIP_COMPILER_ID_IMPLICIT_DIRS - _CMAKE_HIP_COMPILER_ID_IMPLICIT_FWKS - _CMAKE_HIP_COMPILER_ID_IMPLICIT_LOG - "" LANGUAGE HIP) -message(CONFIGURE_LOG - "Parsed HIP implicit link information from compiler id output:\n${_CMAKE_HIP_COMPILER_ID_IMPLICIT_LOG}\n\n") -cmake_parse_library_architecture(HIP "${_CMAKE_HIP_COMPILER_ID_IMPLICIT_DIRS}" "" CMAKE_HIP_LIBRARY_ARCHITECTURE) -if(CMAKE_HIP_LIBRARY_ARCHITECTURE) +if(CMAKE_HIP_PLATFORM STREQUAL "amd") + # For this platform we need the hip-lang cmake package. + + # Normally implicit link information is not detected until ABI detection, + # but we need to populate CMAKE_HIP_LIBRARY_ARCHITECTURE to find hip-lang. + cmake_parse_implicit_link_info("${CMAKE_HIP_COMPILER_PRODUCED_OUTPUT}" + _CMAKE_HIP_COMPILER_ID_IMPLICIT_LIBS + _CMAKE_HIP_COMPILER_ID_IMPLICIT_DIRS + _CMAKE_HIP_COMPILER_ID_IMPLICIT_FWKS + _CMAKE_HIP_COMPILER_ID_IMPLICIT_LOG + "" LANGUAGE HIP) message(CONFIGURE_LOG - "Parsed HIP library architecture from compiler id output: ${CMAKE_HIP_LIBRARY_ARCHITECTURE}\n") -endif() -unset(_CMAKE_HIP_COMPILER_ID_IMPLICIT_LIBS) -unset(_CMAKE_HIP_COMPILER_ID_IMPLICIT_DIRS) -unset(_CMAKE_HIP_COMPILER_ID_IMPLICIT_FWKS) -unset(_CMAKE_HIP_COMPILER_ID_IMPLICIT_LOG) - -if(NOT CMAKE_HIP_COMPILER_ROCM_LIB) - set(_CMAKE_HIP_COMPILER_ROCM_LIB_DIRS - "${CMAKE_HIP_COMPILER_ROCM_ROOT}/lib" - "${CMAKE_HIP_COMPILER_ROCM_ROOT}/lib64" - ) + "Parsed HIP implicit link information from compiler id output:\n${_CMAKE_HIP_COMPILER_ID_IMPLICIT_LOG}\n\n") + cmake_parse_library_architecture(HIP "${_CMAKE_HIP_COMPILER_ID_IMPLICIT_DIRS}" "" CMAKE_HIP_LIBRARY_ARCHITECTURE) if(CMAKE_HIP_LIBRARY_ARCHITECTURE) - list(APPEND _CMAKE_HIP_COMPILER_ROCM_LIB_DIRS "${CMAKE_HIP_COMPILER_ROCM_ROOT}/lib/${CMAKE_HIP_LIBRARY_ARCHITECTURE}") + message(CONFIGURE_LOG + "Parsed HIP library architecture from compiler id output: ${CMAKE_HIP_LIBRARY_ARCHITECTURE}\n") endif() - foreach(dir IN LISTS _CMAKE_HIP_COMPILER_ROCM_LIB_DIRS) - if(EXISTS "${dir}/cmake/hip-lang/hip-lang-config.cmake") - set(CMAKE_HIP_COMPILER_ROCM_LIB "${dir}") - break() - endif() - endforeach() + unset(_CMAKE_HIP_COMPILER_ID_IMPLICIT_LIBS) + unset(_CMAKE_HIP_COMPILER_ID_IMPLICIT_DIRS) + unset(_CMAKE_HIP_COMPILER_ID_IMPLICIT_FWKS) + unset(_CMAKE_HIP_COMPILER_ID_IMPLICIT_LOG) + if(NOT CMAKE_HIP_COMPILER_ROCM_LIB) - list(TRANSFORM _CMAKE_HIP_COMPILER_ROCM_LIB_DIRS APPEND "/cmake/hip-lang/hip-lang-config.cmake") - string(REPLACE ";" "\n " _CMAKE_HIP_COMPILER_ROCM_LIB_DIRS "${_CMAKE_HIP_COMPILER_ROCM_LIB_DIRS}") - message(FATAL_ERROR - "The ROCm root directory:\n" - " ${CMAKE_HIP_COMPILER_ROCM_ROOT}\n" - "does not contain the HIP runtime CMake package, expected at one of:\n" - " ${_CMAKE_HIP_COMPILER_ROCM_LIB_DIRS}\n" + set(_CMAKE_HIP_COMPILER_ROCM_LIB_DIRS + "${CMAKE_HIP_COMPILER_ROCM_ROOT}/lib" + "${CMAKE_HIP_COMPILER_ROCM_ROOT}/lib64" ) + if(CMAKE_HIP_LIBRARY_ARCHITECTURE) + list(APPEND _CMAKE_HIP_COMPILER_ROCM_LIB_DIRS "${CMAKE_HIP_COMPILER_ROCM_ROOT}/lib/${CMAKE_HIP_LIBRARY_ARCHITECTURE}") + endif() + foreach(dir IN LISTS _CMAKE_HIP_COMPILER_ROCM_LIB_DIRS) + if(EXISTS "${dir}/cmake/hip-lang/hip-lang-config.cmake") + set(CMAKE_HIP_COMPILER_ROCM_LIB "${dir}") + break() + endif() + endforeach() + if(NOT CMAKE_HIP_COMPILER_ROCM_LIB) + list(TRANSFORM _CMAKE_HIP_COMPILER_ROCM_LIB_DIRS APPEND "/cmake/hip-lang/hip-lang-config.cmake") + string(REPLACE ";" "\n " _CMAKE_HIP_COMPILER_ROCM_LIB_DIRS "${_CMAKE_HIP_COMPILER_ROCM_LIB_DIRS}") + message(FATAL_ERROR + "The ROCm root directory:\n" + " ${CMAKE_HIP_COMPILER_ROCM_ROOT}\n" + "does not contain the HIP runtime CMake package, expected at one of:\n" + " ${_CMAKE_HIP_COMPILER_ROCM_LIB_DIRS}\n" + ) + endif() + unset(_CMAKE_HIP_COMPILER_ROCM_LIB_DIRS) + endif() + if(CMAKE_HIP_COMPILER_ROCM_LIB MATCHES "/lib64$" AND NOT DEFINED CMAKE_SIZEOF_VOID_P) + # We have not yet determined the target ABI but we need 'find_package' to + # search lib64 directories to find hip-lang CMake package dependencies. + # This will be replaced by ABI detection later. + set(CMAKE_HIP_SIZEOF_DATA_PTR 8) endif() - unset(_CMAKE_HIP_COMPILER_ROCM_LIB_DIRS) -endif() -if(CMAKE_HIP_COMPILER_ROCM_LIB MATCHES "/lib64$" AND NOT DEFINED CMAKE_SIZEOF_VOID_P) - # We have not yet determined the target ABI but we need 'find_package' to - # search lib64 directories to find hip-lang CMake package dependencies. - # This will be replaced by ABI detection later. - set(CMAKE_HIP_SIZEOF_DATA_PTR 8) endif() if (NOT _CMAKE_TOOLCHAIN_LOCATION) diff --git a/Modules/CheckLanguage.cmake b/Modules/CheckLanguage.cmake index 04e721c..94948b9 100644 --- a/Modules/CheckLanguage.cmake +++ b/Modules/CheckLanguage.cmake @@ -25,8 +25,8 @@ or :command:`project` commands: If this variable is already set, either explicitly or cached by a previous call, the check is skipped. - :variable:`CMAKE_CUDA_HOST_COMPILER` - This variable is set when ``<lang>`` is ``CUDA``. + :variable:`CMAKE_<LANG>_HOST_COMPILER` + This variable is set when ``<lang>`` is ``CUDA`` or ``HIP``. If the check detects an explicit host compiler that is required for compilation, this variable will be set to that compiler. @@ -34,12 +34,12 @@ or :command:`project` commands: this variable will be cleared. If this variable is already set, its value is preserved only if - :variable:`CMAKE_CUDA_COMPILER <CMAKE_<LANG>_COMPILER>` is also set. + :variable:`CMAKE_<LANG>_COMPILER` is also set. Otherwise, the check runs and overwrites - :variable:`CMAKE_CUDA_HOST_COMPILER` with a new result. - Note that :variable:`CMAKE_CUDA_HOST_COMPILER` documents it should + :variable:`CMAKE_<LANG>_HOST_COMPILER` with a new result. + Note that :variable:`CMAKE_<LANG>_HOST_COMPILER` documents it should not be set without also setting - :variable:`CMAKE_CUDA_COMPILER <CMAKE_<LANG>_COMPILER>` to a NVCC compiler. + :variable:`CMAKE_<LANG>_COMPILER` to a NVCC compiler. For example: @@ -65,7 +65,7 @@ macro(check_language lang) file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Check${lang}) set(extra_compiler_variables) - if(${lang} STREQUAL CUDA AND NOT CMAKE_GENERATOR MATCHES "Visual Studio") + if("${lang}" MATCHES "^(CUDA|HIP)$" AND NOT CMAKE_GENERATOR MATCHES "Visual Studio") set(extra_compiler_variables "set(CMAKE_CUDA_HOST_COMPILER \\\"\${CMAKE_CUDA_HOST_COMPILER}\\\")") endif() diff --git a/Modules/Compiler/IBMClang-CXX.cmake b/Modules/Compiler/IBMClang-CXX.cmake index 5431b17..be9b525 100644 --- a/Modules/Compiler/IBMClang-CXX.cmake +++ b/Modules/Compiler/IBMClang-CXX.cmake @@ -31,6 +31,8 @@ if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 17.1.0) set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17") set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std=c++20") set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std=gnu++20") + set(CMAKE_CXX23_STANDARD_COMPILE_OPTION "-std=c++2b") + set(CMAKE_CXX23_EXTENSION_COMPILE_OPTION "-std=gnu++2b") endif() __compiler_check_default_language_standard(CXX 17.1.0 17) diff --git a/Modules/Compiler/NVIDIA-HIP.cmake b/Modules/Compiler/NVIDIA-HIP.cmake index e144ff8..c888bc7 100644 --- a/Modules/Compiler/NVIDIA-HIP.cmake +++ b/Modules/Compiler/NVIDIA-HIP.cmake @@ -2,10 +2,8 @@ include(Compiler/NVIDIA) __compiler_nvidia_cxx_standards(HIP) __compiler_nvidia_cuda_flags(HIP) -# The ROCm hip-lang package does not work for nvcc, -# so provide a minimal one ourselves. -add_library(hip-lang::device INTERFACE IMPORTED) -set(_CMAKE_HIP_DEVICE_RUNTIME_TARGET hip-lang::device) +# The ROCm hip-lang cmake package's device runtime library is not needed for NVIDIA GPUs. +set(_CMAKE_HIP_DEVICE_RUNTIME_TARGET "") set(CMAKE_HIP_STANDARD_INCLUDE_DIRECTORIES "${CMAKE_HIP_COMPILER_ROCM_ROOT}/include") diff --git a/Modules/Compiler/OrangeC-ASM.cmake b/Modules/Compiler/OrangeC-ASM.cmake new file mode 100644 index 0000000..fe78911 --- /dev/null +++ b/Modules/Compiler/OrangeC-ASM.cmake @@ -0,0 +1,7 @@ +include(Compiler/OrangeC) +__compiler_orangec(ASM) + +set(CMAKE_ASM_OUTPUT_EXTENSION ".o") +set(CMAKE_ASM_VERBOSE_FLAG "-yyyyy") + +set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;S;asm;nas) diff --git a/Modules/Compiler/OrangeC-C.cmake b/Modules/Compiler/OrangeC-C.cmake new file mode 100644 index 0000000..15a6476 --- /dev/null +++ b/Modules/Compiler/OrangeC-C.cmake @@ -0,0 +1,20 @@ +include(Compiler/OrangeC) +include(Compiler/CMakeCommonCompilerMacros) + +set(CMAKE_C_OUTPUT_EXTENSION ".o") +set(CMAKE_C_VERBOSE_FLAG "-yyyyy") +set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c) + +set(CMAKE_C90_STANDARD_COMPILE_OPTION -std=c89) +set(CMAKE_C90_EXTENSION_COMPILE_OPTION -std=c89) +set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON) +set(CMAKE_C99_STANDARD_COMPILE_OPTION -std=c99) +set(CMAKE_C99_EXTENSION_COMPILE_OPTION -std=c99) +set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON) +set(CMAKE_C11_STANDARD_COMPILE_OPTION -std=c11) +set(CMAKE_C11_EXTENSION_COMPILE_OPTION -std=c11) +set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON) + +__compiler_orangec(C) +#- 6.38 is the earliest version which version info is available in the preprocessor +__compiler_check_default_language_standard(C 6.38 11) diff --git a/Modules/Compiler/OrangeC-CXX.cmake b/Modules/Compiler/OrangeC-CXX.cmake new file mode 100644 index 0000000..3f9d59c --- /dev/null +++ b/Modules/Compiler/OrangeC-CXX.cmake @@ -0,0 +1,25 @@ +include(Compiler/OrangeC) +include(Compiler/CMakeCommonCompilerMacros) + +set(_ORANGEC_COMPILE_CXX " -x c++") +set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++) + +set(CMAKE_CXX_OUTPUT_EXTENSION ".o") +set(CMAKE_CXX_VERBOSE_FLAG "-yyyyy") + + + +#- OrangeC is a little lax when accepting compiler version specifications. +# Usually changing the version only changes the value of __cplusplus. +# Also we don't support CXX98 +set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11") +set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=c++11") +set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON) + +set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14") +set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=c++14") +set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON) + +__compiler_orangec(CXX) +#- 6.38 is the earliest version which version info is available in the preprocessor +__compiler_check_default_language_standard(CXX 6.38 14) diff --git a/Modules/Compiler/OrangeC-DetermineCompiler.cmake b/Modules/Compiler/OrangeC-DetermineCompiler.cmake new file mode 100644 index 0000000..2ecc140 --- /dev/null +++ b/Modules/Compiler/OrangeC-DetermineCompiler.cmake @@ -0,0 +1,7 @@ + +set(_compiler_id_pp_test "defined(__ORANGEC__)") + +set(_compiler_id_version_compute " +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__ORANGEC_MAJOR__) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__ORANGEC_MINOR__) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__ORANGEC_PATCHLEVEL__)") diff --git a/Modules/Compiler/OrangeC.cmake b/Modules/Compiler/OrangeC.cmake new file mode 100644 index 0000000..fbb245b --- /dev/null +++ b/Modules/Compiler/OrangeC.cmake @@ -0,0 +1,33 @@ +include_guard() + +macro(__compiler_orangec lang) + if ("x${lang}" MATCHES "^x(C|CXX)$") + set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> ${_ORANGEC_COMPILE_${lang}} -! <SOURCE> <DEFINES> <INCLUDES> <FLAGS> +i -o <PREPROCESSED_SOURCE>") + set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> ${_ORANGEC_COMPILE_${lang}} -! <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -S -o <ASSEMBLY_SOURCE>") + endif() + set(CMAKE_${lang}_COMPILE_OBJECT "<CMAKE_${lang}_COMPILER> ${_ORANGEC_COMPILE_${lang}} -! -c <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>") + unset(_ORANGEC_COMPILE_${lang}) + + set(CMAKE_DEPFILE_FLAGS_${lang} "-MD -MT <DEP_TARGET> -MF <DEP_FILE>") + set(CMAKE_${lang}_DEPFILE_FORMAT gcc) + set(CMAKE_${lang}_DEPENDS_USE_COMPILER TRUE) + + string(APPEND CMAKE_${lang}_FLAGS_INIT " ") + string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g") + string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O2 -DNDEBUG") + string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -O1 -DNDEBUG") + string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -g -DNDEBUG") + + set(CMAKE_${lang}_CREATE_STATIC_LIBRARY + "<CMAKE_${lang}_COMPILER> -! -static -o <TARGET> <LINK_FLAGS> <OBJECTS> ") + set(CMAKE_${lang}_LINK_EXECUTABLE "<CMAKE_${lang}_COMPILER> -! <FLAGS> -o <TARGET> --out-implib <TARGET_IMPLIB> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> <LINK_LIBRARIES>") + set(CMAKE_${lang}_CREATE_SHARED_LIBRARY + "<CMAKE_${lang}_COMPILER> -! <FLAGS> -o <TARGET> --out-implib <TARGET_IMPLIB> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> <OBJECTS> <LINK_LIBRARIES>") + set(CMAKE_${lang}_CREATE_SHARED_MODULE "${CMAKE_${lang}_CREATE_SHARED_LIBRARY}") + + set(CMAKE_LIBRARY_PATH_FLAG "-L") + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-! -shared") + + set(CMAKE_${lang}_RESPONSE_FILE_FLAG "@") + set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "@") +endmacro() diff --git a/Modules/FetchContent.cmake b/Modules/FetchContent.cmake index 4ff43ed..f10684c 100644 --- a/Modules/FetchContent.cmake +++ b/Modules/FetchContent.cmake @@ -111,6 +111,7 @@ Commands FetchContent_Declare( <name> <contentOptions>... + [EXCLUDE_FROM_ALL] [SYSTEM] [OVERRIDE_FIND_PACKAGE | FIND_PACKAGE_ARGS args...] @@ -240,6 +241,15 @@ Commands See the :prop_tgt:`SYSTEM` target property documentation for a more detailed discussion of the effects. + .. versionadded:: 3.28 + + ``EXCLUDE_FROM_ALL`` + If the ``EXCLUDE_FROM_ALL`` argument is provided, then targets in the + subdirectory added by :command:`FetchContent_MakeAvailable` will not be + included in the ``ALL`` target by default, and may be excluded from IDE + project files. See the `:command:`add_subdirectory` `EXCLUDE_FROM_ALL`` + argument documentation for a more detailed discussion of the effects. + .. command:: FetchContent_MakeAvailable .. versionadded:: 3.14 @@ -358,6 +368,11 @@ Commands :command:`FetchContent_Declare`, the ``SYSTEM`` keyword will be added to the :command:`add_subdirectory` command as well. + .. versionadded:: 3.28 + If the ``EXCLUDE_FROM_ALL`` keyword was included in the call to + :command:`FetchContent_Declare`, the ``EXCLUDE_FROM_ALL`` keyword will + be added to the :command:`add_subdirectory` command as well. + Projects should aim to declare the details of all dependencies they might use before they call ``FetchContent_MakeAvailable()`` for any of them. This ensures that if any of the dependencies are also sub-dependencies of @@ -1466,8 +1481,10 @@ function(__FetchContent_directPopulate contentName) set(options QUIET - # SYSTEM has no meaning for ExternalProject, it is only used by us in - # FetchContent_MakeAvailable(). We need to parse and discard it here. + # EXCLUDE_FROM_ALL and SYSTEM have no meaning for ExternalProject, they + # are only used by us in FetchContent_MakeAvailable(). We need to parse + # and discard them here. + EXCLUDE_FROM_ALL SYSTEM ) set(oneValueArgs @@ -2030,22 +2047,28 @@ macro(FetchContent_MakeAvailable) if("${__cmake_contentDetails}" STREQUAL "") message(FATAL_ERROR "No details have been set for content: ${__cmake_contentName}") endif() - cmake_parse_arguments(__cmake_arg "SYSTEM" "SOURCE_SUBDIR" "" ${__cmake_contentDetails}) + cmake_parse_arguments(__cmake_arg "EXCLUDE_FROM_ALL;SYSTEM" "SOURCE_SUBDIR" "" ${__cmake_contentDetails}) if(NOT "${__cmake_arg_SOURCE_SUBDIR}" STREQUAL "") string(APPEND __cmake_srcdir "/${__cmake_arg_SOURCE_SUBDIR}") endif() if(EXISTS ${__cmake_srcdir}/CMakeLists.txt) - if (__cmake_arg_SYSTEM) - add_subdirectory(${__cmake_srcdir} ${${__cmake_contentNameLower}_BINARY_DIR} SYSTEM) - else() - add_subdirectory(${__cmake_srcdir} ${${__cmake_contentNameLower}_BINARY_DIR}) + set(__cmake_add_subdirectory_args ${__cmake_srcdir} ${${__cmake_contentNameLower}_BINARY_DIR}) + if(__cmake_arg_EXCLUDE_FROM_ALL) + list(APPEND __cmake_add_subdirectory_args EXCLUDE_FROM_ALL) + endif() + if(__cmake_arg_SYSTEM) + list(APPEND __cmake_add_subdirectory_args SYSTEM) endif() + add_subdirectory(${__cmake_add_subdirectory_args}) endif() unset(__cmake_srcdir) unset(__cmake_contentDetails) + unset(__cmake_arg_EXCLUDE_FROM_ALL) + unset(__cmake_arg_SYSTEM) unset(__cmake_arg_SOURCE_SUBDIR) + unset(__cmake_add_subdirectory_args) endif() endforeach() diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake index cd912c3..151b215 100644 --- a/Modules/FindOpenMP.cmake +++ b/Modules/FindOpenMP.cmake @@ -298,8 +298,9 @@ function(_OPENMP_GET_FLAGS LANG FLAG_MODE OPENMP_FLAG_VAR OPENMP_LIB_NAMES_VAR) set("${OPENMP_LIB_NAMES_VAR}" "" PARENT_SCOPE) endif() break() - elseif(CMAKE_${LANG}_COMPILER_ID STREQUAL "AppleClang" - AND CMAKE_${LANG}_COMPILER_VERSION VERSION_GREATER_EQUAL "7.0") + elseif((CMAKE_${LANG}_COMPILER_ID STREQUAL "AppleClang" + AND CMAKE_${LANG}_COMPILER_VERSION VERSION_GREATER_EQUAL "7.0") OR + (CMAKE_${LANG}_COMPILER_ID STREQUAL "Clang" AND APPLE)) # Check for separate OpenMP library on AppleClang 7+ find_library(OpenMP_libomp_LIBRARY diff --git a/Modules/Platform/Windows-OrangeC-C.cmake b/Modules/Platform/Windows-OrangeC-C.cmake new file mode 100644 index 0000000..6b7e6b5 --- /dev/null +++ b/Modules/Platform/Windows-OrangeC-C.cmake @@ -0,0 +1,2 @@ +include(Platform/Windows-OrangeC) +__windows_compiler_orangec(C) diff --git a/Modules/Platform/Windows-OrangeC-CXX.cmake b/Modules/Platform/Windows-OrangeC-CXX.cmake new file mode 100644 index 0000000..7de6716 --- /dev/null +++ b/Modules/Platform/Windows-OrangeC-CXX.cmake @@ -0,0 +1,2 @@ +include(Platform/Windows-OrangeC) +__windows_compiler_orangec(CXX) diff --git a/Modules/Platform/Windows-OrangeC.cmake b/Modules/Platform/Windows-OrangeC.cmake new file mode 100644 index 0000000..4f66e0e --- /dev/null +++ b/Modules/Platform/Windows-OrangeC.cmake @@ -0,0 +1,10 @@ +set(CMAKE_LINK_LIBRARY_SUFFIX "") +set(CMAKE_STATIC_LIBRARY_SUFFIX ".l") +set(CMAKE_IMPORT_LIBRARY_SUFFIX ".l") +set(CMAKE_FIND_LIBRARY_PREFIXES "") +set(CMAKE_FIND_LIBRARY_SUFFIXES ".l") + +macro(__windows_compiler_orangec lang) + set(CMAKE_${lang}_CREATE_WIN32_EXE "-Wg") + set(CMAKE_${lang}_CREATE_CONSOLE_EXE "-Wc") +endmacro() diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 5b5fe9c..a43b708 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 27) -set(CMake_VERSION_PATCH 20230925) +set(CMake_VERSION_PATCH 20230927) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index 2d6ce98..b13576a 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -330,10 +330,7 @@ std::string cmCommonTargetGenerator::GenerateCodeCheckRules( auto evaluatedProp = cmGeneratorExpression::Evaluate( *value, this->GeneratorTarget->GetLocalGenerator(), config, this->GeneratorTarget, nullptr, this->GeneratorTarget, lang); - if (!evaluatedProp.empty()) { - return evaluatedProp; - } - return *value; + return evaluatedProp; }; std::string const tidy_prop = cmStrCat(lang, "_CLANG_TIDY"); tidy = evaluateProp(tidy_prop); diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 0674d5a..ee40bd5 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -732,10 +732,16 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode( // The link and compile lines for ABI detection step need to not use // response files so we can extract implicit includes given to // the underlying host compiler - if (testLangs.find("CUDA") != testLangs.end()) { - fprintf(fout, "set(CMAKE_CUDA_USE_RESPONSE_FILE_FOR_INCLUDES OFF)\n"); - fprintf(fout, "set(CMAKE_CUDA_USE_RESPONSE_FILE_FOR_LIBRARIES OFF)\n"); - fprintf(fout, "set(CMAKE_CUDA_USE_RESPONSE_FILE_FOR_OBJECTS OFF)\n"); + static std::array<std::string, 2> const noRSP{ { "CUDA", "HIP" } }; + for (std::string const& lang : noRSP) { + if (testLangs.find(lang) != testLangs.end()) { + fprintf(fout, "set(CMAKE_%s_USE_RESPONSE_FILE_FOR_INCLUDES OFF)\n", + lang.c_str()); + fprintf(fout, "set(CMAKE_%s_USE_RESPONSE_FILE_FOR_LIBRARIES OFF)\n", + lang.c_str()); + fprintf(fout, "set(CMAKE_%s_USE_RESPONSE_FILE_FOR_OBJECTS OFF)\n", + lang.c_str()); + } } } fprintf(fout, "set(CMAKE_VERBOSE_MAKEFILE 1)\n"); diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index b239408..50334ef 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -153,10 +153,12 @@ std::string GeneratorExpressionContent::EvaluateParameters( return std::string(); } std::string parameter; - for (const auto& pExprEval : *pit) { - parameter += pExprEval->Evaluate(context, dagChecker); - if (context->HadError) { - return std::string(); + if (node->ShouldEvaluateNextParameter(parameters, parameter)) { + for (const auto& pExprEval : *pit) { + parameter += pExprEval->Evaluate(context, dagChecker); + if (context->HadError) { + return std::string(); + } } } parameters.push_back(std::move(parameter)); diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 745a749..57beb72 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -128,6 +128,16 @@ struct BooleanOpNode : public cmGeneratorExpressionNode int NumExpectedParameters() const override { return OneOrMoreParameters; } + bool ShouldEvaluateNextParameter(const std::vector<std::string>& parameters, + std::string& def_value) const override + { + if (!parameters.empty() && parameters[0] == failureVal) { + def_value = failureVal; + return false; + } + return true; + } + std::string Evaluate(const std::vector<std::string>& parameters, cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, @@ -195,6 +205,13 @@ static const struct IfNode : public cmGeneratorExpressionNode int NumExpectedParameters() const override { return 3; } + bool ShouldEvaluateNextParameter(const std::vector<std::string>& parameters, + std::string&) const override + { + return (parameters.empty() || + parameters[0] != cmStrCat(parameters.size() - 1, "")); + } + std::string Evaluate(const std::vector<std::string>& parameters, cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, diff --git a/Source/cmGeneratorExpressionNode.h b/Source/cmGeneratorExpressionNode.h index f068b02..7a76289 100644 --- a/Source/cmGeneratorExpressionNode.h +++ b/Source/cmGeneratorExpressionNode.h @@ -33,6 +33,12 @@ struct cmGeneratorExpressionNode virtual int NumExpectedParameters() const { return 1; } + virtual bool ShouldEvaluateNextParameter(const std::vector<std::string>&, + std::string&) const + { + return true; + } + virtual std::string Evaluate( const std::vector<std::string>& parameters, cmGeneratorExpressionContext* context, diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 9e61d9b..04d7bb1 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -4286,9 +4286,6 @@ std::string cmGeneratorTarget::GetPchHeader(const std::string& config, this->GetGlobalGenerator()->FindGeneratorTarget(*pchReuseFrom); } - filename = cmStrCat( - generatorTarget->LocalGenerator->GetCurrentBinaryDirectory(), "/"); - const std::map<std::string, std::string> languageToExtension = { { "C", ".h" }, { "CXX", ".hxx" }, @@ -4296,8 +4293,7 @@ std::string cmGeneratorTarget::GetPchHeader(const std::string& config, { "OBJCXX", ".objcxx.hxx" } }; - filename = - cmStrCat(filename, "CMakeFiles/", generatorTarget->GetName(), ".dir"); + filename = generatorTarget->GetSupportDirectory(); if (this->GetGlobalGenerator()->IsMultiConfig()) { filename = cmStrCat(filename, "/", config); @@ -4390,9 +4386,7 @@ std::string cmGeneratorTarget::GetPchSource(const std::string& config, this->GetGlobalGenerator()->FindGeneratorTarget(*pchReuseFrom); } - filename = - cmStrCat(generatorTarget->LocalGenerator->GetCurrentBinaryDirectory(), - "/CMakeFiles/", generatorTarget->GetName(), ".dir/cmake_pch"); + filename = cmStrCat(generatorTarget->GetSupportDirectory(), "/cmake_pch"); // For GCC the source extension will be transformed into .h[xx].gch if (!this->Makefile->IsOn("CMAKE_LINK_PCH")) { diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index d5099ee..933e754 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2690,13 +2690,9 @@ cmGlobalGenerator::SplitFrameworkPath(const std::string& path, return cm::nullopt; } -bool cmGlobalGenerator::CheckCMP0037(std::string const& targetName, - std::string const& reason) const +static bool RaiseCMP0037Message(cmake* cm, cmTarget* tgt, + std::string const& reason) { - cmTarget* tgt = this->FindTarget(targetName); - if (!tgt) { - return true; - } MessageType messageType = MessageType::AUTHOR_WARNING; std::ostringstream e; bool issueMessage = false; @@ -2715,13 +2711,12 @@ bool cmGlobalGenerator::CheckCMP0037(std::string const& targetName, break; } if (issueMessage) { - e << "The target name \"" << targetName << "\" is reserved " << reason + e << "The target name \"" << tgt->GetName() << "\" is reserved " << reason << "."; if (messageType == MessageType::AUTHOR_WARNING) { e << " It may result in undefined behavior."; } - this->GetCMakeInstance()->IssueMessage(messageType, e.str(), - tgt->GetBacktrace()); + cm->IssueMessage(messageType, e.str(), tgt->GetBacktrace()); if (messageType == MessageType::FATAL_ERROR) { return false; } @@ -2729,6 +2724,16 @@ bool cmGlobalGenerator::CheckCMP0037(std::string const& targetName, return true; } +bool cmGlobalGenerator::CheckCMP0037(std::string const& targetName, + std::string const& reason) const +{ + cmTarget* tgt = this->FindTarget(targetName); + if (!tgt) { + return true; + } + return RaiseCMP0037Message(this->GetCMakeInstance(), tgt, reason); +} + void cmGlobalGenerator::CreateDefaultGlobalTargets( std::vector<GlobalTargetInfo>& targets) { @@ -3142,10 +3147,11 @@ bool cmGlobalGenerator::IsReservedTarget(std::string const& name) // by one or more of the cmake generators. // Adding additional targets to this list will require a policy! - const char* reservedTargets[] = { "all", "ALL_BUILD", "help", - "install", "INSTALL", "preinstall", - "clean", "edit_cache", "rebuild_cache", - "ZERO_CHECK" }; + static const cm::static_string_view reservedTargets[] = { + "all"_s, "ALL_BUILD"_s, "help"_s, "install"_s, + "INSTALL"_s, "preinstall"_s, "clean"_s, "edit_cache"_s, + "rebuild_cache"_s, "ZERO_CHECK"_s + }; return cm::contains(reservedTargets, name); } diff --git a/Source/cmLinkLineDeviceComputer.cxx b/Source/cmLinkLineDeviceComputer.cxx index ded6466..28aa5d9 100644 --- a/Source/cmLinkLineDeviceComputer.cxx +++ b/Source/cmLinkLineDeviceComputer.cxx @@ -101,9 +101,7 @@ void cmLinkLineDeviceComputer::ComputeLinkLibraries( ItemVector const& items = cli.GetItems(); std::string config = cli.GetConfig(); bool skipItemAfterFramework = false; - // Note: - // Any modification of this algorithm should be reflected also in - // cmVisualStudio10TargetGenerator::ComputeCudaLinkOptions + for (auto const& item : items) { if (skipItemAfterFramework) { skipItemAfterFramework = false; @@ -132,11 +130,13 @@ void cmLinkLineDeviceComputer::ComputeLinkLibraries( BT<std::string> linkLib; if (item.IsPath == cmComputeLinkInformation::ItemIsPath::Yes) { - // nvcc understands absolute paths to libraries ending in '.a' or '.lib'. - // These should be passed to nvlink. Other extensions need to be left - // out because nvlink may not understand or need them. Even though it - // can tolerate '.so' or '.dylib' it cannot tolerate '.so.1'. - if (cmHasLiteralSuffix(item.Value.Value, ".a") || + // nvcc understands absolute paths to libraries ending in '.o', .a', or + // '.lib'. These should be passed to nvlink. Other extensions need to be + // left out because nvlink may not understand or need them. Even though + // it can tolerate '.so' or '.dylib' it cannot tolerate '.so.1'. + if (cmHasLiteralSuffix(item.Value.Value, ".o") || + cmHasLiteralSuffix(item.Value.Value, ".obj") || + cmHasLiteralSuffix(item.Value.Value, ".a") || cmHasLiteralSuffix(item.Value.Value, ".lib")) { linkLib.Value = item .GetFormattedItem(this->ConvertToOutputFormat( diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index d6d3999..a33c5db 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -1175,7 +1175,7 @@ bool cmQtAutoGenInitializer::InitScanFiles() // Path checksum qrc.QrcPathChecksum = this->PathCheckSum.getPart(qrc.QrcFile); // Output file name - if (this->CrossConfig) { + if (this->MultiConfig && !this->GlobalGen->IsXcode()) { qrc.OutputFile = cmStrCat(this->Dir.Build, '/', qrc.QrcPathChecksum, "_$<CONFIG>", "/qrc_", qrc.QrcName, ".cpp"); } else { @@ -1467,7 +1467,7 @@ bool cmQtAutoGenInitializer::InitAutogenTarget() std::string outputFile; std::string depFile; // Create the custom command that outputs the timestamp file. - if (this->MultiConfig && this->CrossConfig) { + if (this->MultiConfig) { // create timestamp file with $<CONFIG> in the name so that // every cmake_autogen target has its own timestamp file std::string const configView = "$<CONFIG>"; @@ -1577,6 +1577,12 @@ void cmQtAutoGenInitializer::AddCMakeProcessToCommandLines( commandLines.push_back(cmMakeCommandLine( { cmSystemTools::GetCMakeCommand(), "-E", processName, infoFile, "$<CONFIG>", "$<COMMAND_CONFIG:$<CONFIG>>" })); + } else if (this->MultiConfig && this->GlobalGen->IsXcode()) { + for (std::string const& config : this->ConfigsList) { + commandLines.push_back( + cmMakeCommandLine({ cmSystemTools::GetCMakeCommand(), "-E", + processName, infoFile, config })); + } } else { std::string autoInfoFileConfig; if (this->MultiConfig) { @@ -1934,6 +1940,7 @@ bool cmQtAutoGenInitializer::SetupWriteRccInfo() info.SetBool("MULTI_CONFIG", this->MultiConfig); info.SetBool("CROSS_CONFIG", this->CrossConfig); info.SetUInt("VERBOSITY", this->Verbosity); + info.Set("GENERATOR", this->GlobalGen->GetName()); // Files info.Set("LOCK_FILE", qrc.LockFile); diff --git a/Source/cmQtAutoRcc.cxx b/Source/cmQtAutoRcc.cxx index 488f704..576f611 100644 --- a/Source/cmQtAutoRcc.cxx +++ b/Source/cmQtAutoRcc.cxx @@ -35,6 +35,11 @@ public: private: // -- Utility bool IsMultiConfig() const { return this->MultiConfig_; } + std::string const& GetGenerator() const { return this->Generator_; } + bool IsXcode() const + { + return this->GetGenerator().find("Xcode") != std::string::npos; + } std::string MultiConfigOutput() const; // -- Abstract processing interface @@ -54,6 +59,7 @@ private: // -- Config settings bool MultiConfig_ = false; bool CrossConfig_ = false; + std::string Generator_; // -- Directories std::string AutogenBuildDir_; std::string IncludeDir_; @@ -93,6 +99,7 @@ bool cmQtAutoRccT::InitFromInfo(InfoT const& info) { // -- Required settings if (!info.GetBool("MULTI_CONFIG", this->MultiConfig_, true) || + !info.GetString("GENERATOR", this->Generator_, true) || !info.GetBool("CROSS_CONFIG", this->CrossConfig_, true) || !info.GetString("BUILD_DIR", this->AutogenBuildDir_, true) || !info.GetStringConfig("INCLUDE_DIR", this->IncludeDir_, true) || @@ -122,7 +129,7 @@ bool cmQtAutoRccT::InitFromInfo(InfoT const& info) // -- Derive information this->QrcFileName_ = cmSystemTools::GetFilenameName(this->QrcFile_); this->QrcFileDir_ = cmSystemTools::GetFilenamePath(this->QrcFile_); - if (this->CrossConfig_) { + if (IsMultiConfig() && !this->IsXcode()) { this->RccFilePublic_ = cmStrCat(this->AutogenBuildDir_, '/', this->RccPathChecksum_, "_", this->InfoConfig(), '/', this->RccFileName_); diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index ea4bd06..2a54a55 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -3864,22 +3864,41 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaLinkOptions( } cudaLinkOptions.AppendFlagString("AdditionalOptions", linkFlags); - // For static libraries that have device linking enabled compute - // the libraries - if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY && - doDeviceLinking) { - cmComputeLinkInformation& cli = *pcli; - cmLinkLineDeviceComputer computer( - this->LocalGenerator, - this->LocalGenerator->GetStateSnapshot().GetDirectory()); - std::vector<BT<std::string>> btLibVec; - computer.ComputeLinkLibraries(cli, std::string{}, btLibVec); + if (doDeviceLinking) { std::vector<std::string> libVec; - for (auto const& item : btLibVec) { - libVec.emplace_back(item.Value); + auto const& kinded = this->GeneratorTarget->GetKindedSources(configName); + // CMake conversion uses full paths when possible to allow deeper trees. + // However, CUDA 8.0 msbuild rules fail on absolute paths so for CUDA + // we must use relative paths. + const bool forceRelative = true; + for (cmGeneratorTarget::SourceAndKind const& si : kinded.Sources) { + switch (si.Kind) { + case cmGeneratorTarget::SourceKindExternalObject: { + std::string path = + this->ConvertPath(si.Source.Value->GetFullPath(), forceRelative); + ConvertToWindowsSlash(path); + libVec.emplace_back(std::move(path)); + } break; + default: + break; + } + } + // For static libraries that have device linking enabled compute + // the libraries + if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY) { + cmComputeLinkInformation& cli = *pcli; + cmLinkLineDeviceComputer computer( + this->LocalGenerator, + this->LocalGenerator->GetStateSnapshot().GetDirectory()); + std::vector<BT<std::string>> btLibVec; + computer.ComputeLinkLibraries(cli, std::string{}, btLibVec); + for (auto const& item : btLibVec) { + libVec.emplace_back(item.Value); + } + } + if (!libVec.empty()) { + cudaLinkOptions.AddFlag("AdditionalDependencies", libVec); } - - cudaLinkOptions.AddFlag("AdditionalDependencies", libVec); } this->CudaLinkOptions[configName] = std::move(pOptions); diff --git a/Tests/Assembler/CMakeLists.txt b/Tests/Assembler/CMakeLists.txt index 4635f03..56de257 100644 --- a/Tests/Assembler/CMakeLists.txt +++ b/Tests/Assembler/CMakeLists.txt @@ -12,7 +12,7 @@ set(SRCS) # and also generate assembler files from C: if("${CMAKE_GENERATOR}" MATCHES "Makefile|Xcode|Ninja" AND NOT CMAKE_OSX_ARCHITECTURES MATCHES ";") - if((CMAKE_C_COMPILER_ID MATCHES "^(GNU|LCC|Clang|AppleClang|HP|SunPro|XL)$") OR (CMAKE_C_COMPILER_ID MATCHES "Intel" AND UNIX) + if((CMAKE_C_COMPILER_ID MATCHES "^(GNU|LCC|Clang|AppleClang|HP|SunPro|XL|OrangeC)$") OR (CMAKE_C_COMPILER_ID MATCHES "Intel" AND UNIX) AND NOT (CMAKE_C_COMPILER_ID STREQUAL "Clang" AND "x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC")) set(C_FLAGS "${CMAKE_C_FLAGS}") separate_arguments(C_FLAGS) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index cd9cc17..915c974 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -117,8 +117,8 @@ if(BUILD_TESTING) if(WIN32 OR CYGWIN) set(CMake_TEST_RESOURCES TRUE) endif() - # for borland and watcom there is no resource support - if(WATCOM OR BORLAND) + # For some Windows toolchains there is no resource support. + if(WATCOM OR BORLAND OR CMAKE_C_COMPILER_ID STREQUAL "OrangeC") set(CMake_TEST_RESOURCES FALSE) endif() @@ -2094,7 +2094,10 @@ if(BUILD_TESTING) ) endif() - if(MAKE_SUPPORTS_SPACES AND NOT CMAKE_GENERATOR STREQUAL "Xcode" AND NOT CMAKE_GENERATOR STREQUAL "Watcom WMake") + if(MAKE_SUPPORTS_SPACES + AND NOT CMAKE_GENERATOR STREQUAL "Xcode" + AND NOT CMAKE_GENERATOR STREQUAL "Watcom WMake" + ) add_test(SubDirSpaces ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/SubDirSpaces" @@ -3000,8 +3003,8 @@ if(BUILD_TESTING) -S "${CMake_BINARY_DIR}/Tests/CTestTestCrash/test.cmake" -V --output-log "${CMake_BINARY_DIR}/Tests/CTestTestCrash/testOutput.log" ) - # with watcom the SEGFAULT is not found, it just fails - if(CMAKE_GENERATOR MATCHES "Watcom WMake") + # With Watcom and OrangeC the SEGFAULT is not found, it just fails + if(CMAKE_GENERATOR MATCHES "Watcom WMake" OR CMAKE_C_COMPILER_ID STREQUAL "OrangeC") set_tests_properties(CTestTestCrash PROPERTIES PASS_REGULAR_EXPRESSION "Failed") else() diff --git a/Tests/CMakeOnly/CheckLanguage/CMakeLists.txt b/Tests/CMakeOnly/CheckLanguage/CMakeLists.txt index 0c76158..f005843 100644 --- a/Tests/CMakeOnly/CheckLanguage/CMakeLists.txt +++ b/Tests/CMakeOnly/CheckLanguage/CMakeLists.txt @@ -13,7 +13,7 @@ endif() unset(expect_Fortran) set(expect_NoSuchLanguage 0) -set(LANGUAGES C CXX Fortran CUDA NoSuchLanguage) +set(LANGUAGES C CXX Fortran CUDA HIP NoSuchLanguage) if(APPLE) list(APPEND LANGUAGES OBJC OBJCXX) endif() diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt index 17f4408..d9bb447 100644 --- a/Tests/CompileFeatures/CMakeLists.txt +++ b/Tests/CompileFeatures/CMakeLists.txt @@ -18,7 +18,7 @@ macro(run_test feature lang) endif() endmacro() -if(NOT CMAKE_C_COMPILER_ID MATCHES "^(Cray|PGI|NVHPC|XL|XLClang|IBMClang|IntelLLVM|Fujitsu|FujitsuClang)$") +if(NOT CMAKE_C_COMPILER_ID MATCHES "^(Cray|PGI|NVHPC|XL|XLClang|IBMClang|IntelLLVM|Fujitsu|FujitsuClang|OrangeC)$") get_property(c_features GLOBAL PROPERTY CMAKE_C_KNOWN_FEATURES) list(FILTER c_features EXCLUDE REGEX "^c_std_[0-9][0-9]") foreach(feature ${c_features}) @@ -26,7 +26,7 @@ if(NOT CMAKE_C_COMPILER_ID MATCHES "^(Cray|PGI|NVHPC|XL|XLClang|IBMClang|IntelLL endforeach() endif() -if(NOT CMAKE_CXX_COMPILER_ID MATCHES "^(Cray|PGI|NVHPC|XL|XLClang|IBMClang|IntelLLVM|Fujitsu|FujitsuClang)$") +if(NOT CMAKE_CXX_COMPILER_ID MATCHES "^(Cray|PGI|NVHPC|XL|XLClang|IBMClang|IntelLLVM|Fujitsu|FujitsuClang|OrangeC)$") get_property(cxx_features GLOBAL PROPERTY CMAKE_CXX_KNOWN_FEATURES) list(FILTER cxx_features EXCLUDE REGEX "^cxx_std_[0-9][0-9]") foreach(feature ${cxx_features}) diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt index d3a184d..fcc2471 100644 --- a/Tests/Complex/CMakeLists.txt +++ b/Tests/Complex/CMakeLists.txt @@ -244,6 +244,12 @@ configure_file( ${Complex_SOURCE_DIR}/Library/dummy ${Complex_BINARY_DIR}/Library/dummylib.lib COPYONLY) +if(CMAKE_C_COMPILER_ID STREQUAL "OrangeC") + configure_file( + ${Complex_SOURCE_DIR}/Library/dummy + ${Complex_BINARY_DIR}/Library/dummylib.l + COPYONLY) +endif() foreach (ext ${CMAKE_SHLIB_SUFFIX};.so;.a;.sl ${CMAKE_SHARED_LIBRARY_SUFFIX}.2 ${CMAKE_STATIC_LIBRARY_SUFFIX}.2) diff --git a/Tests/Complex/Executable/CMakeLists.txt b/Tests/Complex/Executable/CMakeLists.txt index 2a79629..c8668b9 100644 --- a/Tests/Complex/Executable/CMakeLists.txt +++ b/Tests/Complex/Executable/CMakeLists.txt @@ -45,12 +45,8 @@ add_executable(complex.file complex.file.cxx complex_nobuild.cxx if (UNIX) target_link_libraries(complex ${CMAKE_DL_LIBS}) -else() - if (NOT BORLAND) - if(NOT MINGW) - target_link_libraries(complex rpcrt4.lib) - endif() - endif() +elseif(NOT BORLAND AND NOT MINGW AND NOT CMAKE_C_COMPILER_ID STREQUAL "OrangeC") + target_link_libraries(complex rpcrt4.lib) endif () # Test linking to static lib when a shared lib has the same name. diff --git a/Tests/Complex/Library/CMakeLists.txt b/Tests/Complex/Library/CMakeLists.txt index df874ef..d216486 100644 --- a/Tests/Complex/Library/CMakeLists.txt +++ b/Tests/Complex/Library/CMakeLists.txt @@ -23,19 +23,9 @@ set(LibrarySources ${LibrarySources} remove(LibrarySources create_file.cxx GENERATED nonexisting_file) add_library(CMakeTestLibrary ${LibrarySources}) -if(WIN32) - if(NOT CYGWIN) - if(NOT BORLAND) - if(NOT MINGW) - target_link_libraries(CMakeTestLibrary - debug - user32.lib) - target_link_libraries(CMakeTestLibrary - optimized - kernel32.lib) - endif() - endif() - endif() +if(WIN32 AND NOT CYGWIN AND NOT BORLAND AND NOT MINGW AND NOT CMAKE_C_COMPILER_ID STREQUAL "OrangeC") + target_link_libraries(CMakeTestLibrary debug user32.lib) + target_link_libraries(CMakeTestLibrary optimized kernel32.lib) endif() # diff --git a/Tests/ComplexOneConfig/CMakeLists.txt b/Tests/ComplexOneConfig/CMakeLists.txt index dd996e1..e4ae6ba 100644 --- a/Tests/ComplexOneConfig/CMakeLists.txt +++ b/Tests/ComplexOneConfig/CMakeLists.txt @@ -231,6 +231,12 @@ configure_file( ${Complex_SOURCE_DIR}/Library/dummy ${Complex_BINARY_DIR}/Library/dummylib.lib COPYONLY) +if(CMAKE_C_COMPILER_ID STREQUAL "OrangeC") + configure_file( + ${Complex_SOURCE_DIR}/Library/dummy + ${Complex_BINARY_DIR}/Library/dummylib.l + COPYONLY) +endif() foreach (ext ${CMAKE_SHLIB_SUFFIX};.so;.a;.sl) configure_file( ${Complex_SOURCE_DIR}/Library/dummy diff --git a/Tests/ComplexOneConfig/Executable/CMakeLists.txt b/Tests/ComplexOneConfig/Executable/CMakeLists.txt index f935aed..a8ab17b 100644 --- a/Tests/ComplexOneConfig/Executable/CMakeLists.txt +++ b/Tests/ComplexOneConfig/Executable/CMakeLists.txt @@ -45,12 +45,8 @@ add_executable(complex.file complex.file.cxx complex_nobuild.cxx if (UNIX) target_link_libraries(complex ${CMAKE_DL_LIBS}) -else() - if (NOT BORLAND) - if(NOT MINGW) - target_link_libraries(complex rpcrt4.lib) - endif() - endif() +elseif(NOT BORLAND AND NOT MINGW AND NOT CMAKE_C_COMPILER_ID STREQUAL "OrangeC") + target_link_libraries(complex rpcrt4.lib) endif () # Test linking to static lib when a shared lib has the same name. diff --git a/Tests/ComplexOneConfig/Library/CMakeLists.txt b/Tests/ComplexOneConfig/Library/CMakeLists.txt index df874ef..d216486 100644 --- a/Tests/ComplexOneConfig/Library/CMakeLists.txt +++ b/Tests/ComplexOneConfig/Library/CMakeLists.txt @@ -23,19 +23,9 @@ set(LibrarySources ${LibrarySources} remove(LibrarySources create_file.cxx GENERATED nonexisting_file) add_library(CMakeTestLibrary ${LibrarySources}) -if(WIN32) - if(NOT CYGWIN) - if(NOT BORLAND) - if(NOT MINGW) - target_link_libraries(CMakeTestLibrary - debug - user32.lib) - target_link_libraries(CMakeTestLibrary - optimized - kernel32.lib) - endif() - endif() - endif() +if(WIN32 AND NOT CYGWIN AND NOT BORLAND AND NOT MINGW AND NOT CMAKE_C_COMPILER_ID STREQUAL "OrangeC") + target_link_libraries(CMakeTestLibrary debug user32.lib) + target_link_libraries(CMakeTestLibrary optimized kernel32.lib) endif() # diff --git a/Tests/CudaOnly/CMakeLists.txt b/Tests/CudaOnly/CMakeLists.txt index aa25c4c..b7ce5a1 100644 --- a/Tests/CudaOnly/CMakeLists.txt +++ b/Tests/CudaOnly/CMakeLists.txt @@ -20,6 +20,7 @@ add_cuda_test_macro(CudaOnly.CircularLinkLine CudaOnlyCircularLinkLine) add_cuda_test_macro(CudaOnly.ResolveDeviceSymbols CudaOnlyResolveDeviceSymbols) add_cuda_test_macro(CudaOnly.SeparateCompilation main/CudaOnlySeparateCompilation) add_cuda_test_macro(CudaOnly.SeparateCompilationPTX CudaOnlySeparateCompilationPTX) +add_cuda_test_macro(CudaOnly.SeparateCompilationTargetObjects CudaOnlySeparateCompilationTargetObjects) if(CMake_TEST_CUDA AND NOT CMake_TEST_CUDA STREQUAL "Clang") # Clang doesn't have flags for selecting the runtime. diff --git a/Tests/CudaOnly/SeparateCompilationTargetObjects/CMakeLists.txt b/Tests/CudaOnly/SeparateCompilationTargetObjects/CMakeLists.txt new file mode 100644 index 0000000..7dbc0d5 --- /dev/null +++ b/Tests/CudaOnly/SeparateCompilationTargetObjects/CMakeLists.txt @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.25.5) + +project(SeparateCompilationObjects LANGUAGES CUDA) + +add_library(foo OBJECT foo.cu) +set_target_properties(foo PROPERTIES CUDA_SEPARABLE_COMPILATION ON) + +add_library(bar OBJECT bar.cu) +set_target_properties(bar PROPERTIES CUDA_SEPARABLE_COMPILATION ON) + +add_executable(CudaOnlySeparateCompilationTargetObjects main.cu) +set_target_properties(CudaOnlySeparateCompilationTargetObjects PROPERTIES CUDA_SEPARABLE_COMPILATION ON) +target_link_libraries(CudaOnlySeparateCompilationTargetObjects PRIVATE $<TARGET_OBJECTS:foo> bar) + +if(APPLE) + # Help the static cuda runtime find the driver (libcuda.dyllib) at runtime. + set_property(TARGET CudaOnlySeparateCompilationTargetObjects PROPERTY BUILD_RPATH ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}) +endif() diff --git a/Tests/CudaOnly/SeparateCompilationTargetObjects/bar.cu b/Tests/CudaOnly/SeparateCompilationTargetObjects/bar.cu new file mode 100644 index 0000000..234586f --- /dev/null +++ b/Tests/CudaOnly/SeparateCompilationTargetObjects/bar.cu @@ -0,0 +1,18 @@ + +#include <iostream> + +#ifdef _WIN32 +# define EXPORT __declspec(dllexport) +#else +# define EXPORT __attribute__((__visibility__("default"))) +#endif + +__global__ void b1() +{ +} + +EXPORT int bar() +{ + b1<<<1, 1>>>(); + return 0; +} diff --git a/Tests/CudaOnly/SeparateCompilationTargetObjects/foo.cu b/Tests/CudaOnly/SeparateCompilationTargetObjects/foo.cu new file mode 100644 index 0000000..75c04af --- /dev/null +++ b/Tests/CudaOnly/SeparateCompilationTargetObjects/foo.cu @@ -0,0 +1,18 @@ + +#include <iostream> + +#ifdef _WIN32 +# define EXPORT __declspec(dllexport) +#else +# define EXPORT __attribute__((__visibility__("default"))) +#endif + +__global__ void k1() +{ +} + +EXPORT int foo() +{ + k1<<<1, 1>>>(); + return 0; +} diff --git a/Tests/CudaOnly/SeparateCompilationTargetObjects/main.cu b/Tests/CudaOnly/SeparateCompilationTargetObjects/main.cu new file mode 100644 index 0000000..78b10b1 --- /dev/null +++ b/Tests/CudaOnly/SeparateCompilationTargetObjects/main.cu @@ -0,0 +1,16 @@ +// main.cu +#include <iostream> + +#ifdef _WIN32 +# define IMPORT __declspec(dllimport) +#else +# define IMPORT +#endif + +IMPORT int foo(); +IMPORT int bar(); + +int main(int argc, char**) +{ + return foo() && bar(); +} diff --git a/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/check_installed.cmake b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/check_installed.cmake index 6a34697..447a5b6 100644 --- a/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/check_installed.cmake +++ b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/check_installed.cmake @@ -3,7 +3,7 @@ include("${CMAKE_CURRENT_LIST_DIR}/../check_installed.cmake") if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux") check_installed([[^lib;lib/libdep8\.so;lib/liblib\.so;subdir;subdir/bin;subdir/bin/exe1;subdir/bin/exe2;subdir/lib;subdir/lib/libdep10\.so;subdir/lib/libdep11\.so;subdir/lib/libdep2\.so\.1;subdir/lib/libdep2\.so\.1\.2\.3;subdir/lib/libdep3\.so;subdir/lib/libdep5\.so;subdir/lib/libdep6\.so;subdir/lib/libdep8\.so;subdir/lib/libdep9\.so;subdir/lib/liblib\.so;subdir/lib/libmod\.so;subdir/lib/libsublib1\.so$]]) elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") - set(_msvc_check [[bin;bin/dep8\.dll;bin/lib\.dll;lib;lib/lib\.lib;subdir;subdir/bin;subdir/bin/dep10\.dll;subdir/bin/dep11\.dll;subdir/bin/dep2\.dll;subdir/bin/dep3\.dll;subdir/bin/dep5\.dll;subdir/bin/dep6\.dll;subdir/bin/dep8\.dll;subdir/bin/dep9\.dll;subdir/bin/exe1\.exe;subdir/bin/exe2\.exe;subdir/bin/lib\.dll;subdir/bin/sublib1\.dll;subdir/lib;subdir/lib/mod\.dll]]) + set(_msvc_check [[bin;bin/dep8\.dll;bin/lib\.dll;lib;lib/lib\.(lib|l);subdir;subdir/bin;subdir/bin/dep10\.dll;subdir/bin/dep11\.dll;subdir/bin/dep2\.dll;subdir/bin/dep3\.dll;subdir/bin/dep5\.dll;subdir/bin/dep6\.dll;subdir/bin/dep8\.dll;subdir/bin/dep9\.dll;subdir/bin/exe1\.exe;subdir/bin/exe2\.exe;subdir/bin/lib\.dll;subdir/bin/sublib1\.dll;subdir/lib;subdir/lib/mod\.dll]]) set(_mingw_check [[bin;bin/libdep8\.dll;bin/liblib\.dll;lib;lib/liblib\.dll\.a;lib/liblib\.lib;subdir;subdir/bin;subdir/bin/exe1\.exe;subdir/bin/exe2\.exe;subdir/bin/libdep10\.dll;subdir/bin/libdep11\.dll;subdir/bin/libdep2\.dll;subdir/bin/libdep3\.dll;subdir/bin/libdep5\.dll;subdir/bin/libdep6\.dll;subdir/bin/libdep8\.dll;subdir/bin/libdep9\.dll;subdir/bin/liblib\.dll;subdir/bin/libsublib1\.dll;subdir/lib;subdir/lib/libmod\.dll]]) check_installed("^(${_msvc_check}|${_mingw_check})$") elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin") diff --git a/Tests/HIP/ArchSpecial/CMakeLists.txt b/Tests/HIP/ArchSpecial/CMakeLists.txt new file mode 100644 index 0000000..2bc6bd2 --- /dev/null +++ b/Tests/HIP/ArchSpecial/CMakeLists.txt @@ -0,0 +1,66 @@ +cmake_minimum_required(VERSION 3.27) +project(ArchSpecial HIP) + +if(CMAKE_HIP_COMPILER_ID STREQUAL "NVIDIA" AND + CMAKE_HIP_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) + set(compile_options -Wno-deprecated-gpu-targets) +endif() + +function(verify_output flag) + string(REPLACE "-" "_" architectures "${flag}") + string(TOUPPER "${architectures}" architectures) + set(architectures "${CMAKE_HIP_ARCHITECTURES_${architectures}}") + list(TRANSFORM architectures REPLACE "-real" "") + + if(CMAKE_HIP_COMPILER_ID STREQUAL "NVIDIA") + set(match_regex "-arch compute_([0-9]+)") + endif() + + string(REGEX MATCHALL "${match_regex}" target_cpus "${output}") + + foreach(cpu ${target_cpus}) + string(REGEX MATCH "${match_regex}" dont_care "${cpu}") + list(APPEND command_archs "${CMAKE_MATCH_1}") + endforeach() + + list(SORT command_archs) + list(REMOVE_DUPLICATES command_archs) + if(NOT "${command_archs}" STREQUAL "${architectures}") + message(FATAL_ERROR "Architectures used for \"${flag}\" don't match the reference (\"${command_archs}\" != \"${architectures}\").") + endif() +endfunction() + +set(try_compile_flags -v ${compile_options}) + +set(CMAKE_HIP_ARCHITECTURES all) +try_compile(all_archs_compiles + ${CMAKE_CURRENT_BINARY_DIR}/try_compile/all_archs_compiles + ${CMAKE_CURRENT_SOURCE_DIR}/main.hip + COMPILE_DEFINITIONS ${try_compile_flags} + OUTPUT_VARIABLE output + ) +verify_output(all) + +set(CMAKE_HIP_ARCHITECTURES all-major) +try_compile(all_major_archs_compiles + ${CMAKE_CURRENT_BINARY_DIR}/try_compile/all_major_archs_compiles + ${CMAKE_CURRENT_SOURCE_DIR}/main.hip + COMPILE_DEFINITIONS ${try_compile_flags} + OUTPUT_VARIABLE output + ) +verify_output(all-major) + +set(CMAKE_HIP_ARCHITECTURES native) +try_compile(native_archs_compiles + ${CMAKE_CURRENT_BINARY_DIR}/try_compile/native_archs_compiles + ${CMAKE_CURRENT_SOURCE_DIR}/main.hip + COMPILE_DEFINITIONS ${try_compile_flags} + OUTPUT_VARIABLE output + ) +verify_output(native) + +if(all_archs_compiles AND all_major_archs_compiles AND native_archs_compiles) + set(CMAKE_HIP_ARCHITECTURES all) + add_executable(HIPArchSpecial main.hip) + target_compile_options(HIPArchSpecial PRIVATE ${compile_options}) +endif() diff --git a/Tests/HIP/ArchSpecial/main.hip b/Tests/HIP/ArchSpecial/main.hip new file mode 100644 index 0000000..5047a34 --- /dev/null +++ b/Tests/HIP/ArchSpecial/main.hip @@ -0,0 +1,3 @@ +int main() +{ +} diff --git a/Tests/HIP/CMakeLists.txt b/Tests/HIP/CMakeLists.txt index 26d7459..f1e2e51 100644 --- a/Tests/HIP/CMakeLists.txt +++ b/Tests/HIP/CMakeLists.txt @@ -5,6 +5,9 @@ macro (add_hip_test_macro name) endmacro () add_hip_test_macro(HIP.ArchitectureOff HIPOnlyArchitectureOff) +if(CMake_TEST_HIP STREQUAL "nvidia") + add_hip_test_macro(HIP.ArchSpecial HIPArchSpecial) +endif() add_hip_test_macro(HIP.CompileFlags HIPOnlyCompileFlags) add_hip_test_macro(HIP.EnableStandard HIPEnableStandard) add_hip_test_macro(HIP.InferHipLang1 HIPInferHipLang1) diff --git a/Tests/HIP/MixedLanguage/CMakeLists.txt b/Tests/HIP/MixedLanguage/CMakeLists.txt index 4f6dd3b..af58ade 100644 --- a/Tests/HIP/MixedLanguage/CMakeLists.txt +++ b/Tests/HIP/MixedLanguage/CMakeLists.txt @@ -17,3 +17,7 @@ set_target_properties(MixedStaticLib PROPERTIES POSITION_INDEPENDENT_CODE ON) add_executable(HIPMixedLanguage main.cxx) target_link_libraries(HIPMixedLanguage PRIVATE MixedStaticLib MixedSharedLib) + +add_executable(HIPMixedLanguageCXX main.cxx) +target_link_libraries(HIPMixedLanguageCXX PRIVATE MixedStaticLib MixedSharedLib) +set_property(TARGET HIPMixedLanguageCXX PROPERTY LINKER_LANGUAGE CXX) diff --git a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt index f6a26e7..0f2067a 100644 --- a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt +++ b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt @@ -55,7 +55,7 @@ endmacro() # detailed features tables, not just meta-features if (CMAKE_C_COMPILE_FEATURES) - if (NOT CMAKE_C_COMPILER_ID MATCHES "^(LCC|Cray|CrayClang|PGI|NVHPC|XL|XLClang|IBMClang|IntelLLVM|Fujitsu|FujitsuClang)$") + if (NOT CMAKE_C_COMPILER_ID MATCHES "^(LCC|Cray|CrayClang|PGI|NVHPC|XL|XLClang|IBMClang|IntelLLVM|Fujitsu|FujitsuClang|OrangeC)$") set(C_expected_features ${CMAKE_C_COMPILE_FEATURES}) list(FILTER C_expected_features EXCLUDE REGEX "^c_std_[0-9][0-9]") endif() @@ -98,7 +98,7 @@ if (C_expected_features) endif() if (CMAKE_CXX_COMPILE_FEATURES) - if (NOT CMAKE_CXX_COMPILER_ID MATCHES "^(LCC|Cray|CrayClang|PGI|NVHPC|XL|XLClang|IBMClang|IntelLLVM|Fujitsu|FujitsuClang)$") + if (NOT CMAKE_CXX_COMPILER_ID MATCHES "^(LCC|Cray|CrayClang|PGI|NVHPC|XL|XLClang|IBMClang|IntelLLVM|Fujitsu|FujitsuClang|OrangeC)$") set(CXX_expected_features ${CMAKE_CXX_COMPILE_FEATURES}) list(FILTER CXX_expected_features EXCLUDE REGEX "^cxx_std_[0-9][0-9]") endif() diff --git a/Tests/OutDir/OutDir.cmake b/Tests/OutDir/OutDir.cmake index 2a003b8..c42dc49 100644 --- a/Tests/OutDir/OutDir.cmake +++ b/Tests/OutDir/OutDir.cmake @@ -1,5 +1,5 @@ set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "") -set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".a" ".so" ".sl" ".dylib" ".dll.a") +set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".a" ".so" ".sl" ".dylib" ".dll.a" ".l") find_library(TESTC1_LIB NAMES testc1 testc1_test_debug_postfix diff --git a/Tests/RunCMake/AutoExportDll/RunCMakeTest.cmake b/Tests/RunCMake/AutoExportDll/RunCMakeTest.cmake index 75130f2..9f65219 100644 --- a/Tests/RunCMake/AutoExportDll/RunCMakeTest.cmake +++ b/Tests/RunCMake/AutoExportDll/RunCMakeTest.cmake @@ -10,6 +10,9 @@ unset(RunCMake_TEST_OPTIONS) if(RunCMake_GENERATOR MATCHES "Watcom WMake|Borland Makefiles") return() endif() +if(CMAKE_CXX_COMPILER_ID STREQUAL "OrangeC") + return() +endif() if(RunCMake_GENERATOR MATCHES "Ninja|Visual Studio" AND CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") set(EXPORTS TRUE) diff --git a/Tests/RunCMake/Autogen/AutoMocExecutableConfig.cmake b/Tests/RunCMake/Autogen/AutoMocExecutableConfig.cmake index fd3614c..3ee9be9 100644 --- a/Tests/RunCMake/Autogen/AutoMocExecutableConfig.cmake +++ b/Tests/RunCMake/Autogen/AutoMocExecutableConfig.cmake @@ -1,17 +1,9 @@ -enable_language(CXX) - -set(CMAKE_CXX_STANDARD 11) -find_package(Qt${with_qt_version} REQUIRED COMPONENTS Core Widgets Gui) +include(MocExample.cmake) if(NOT TARGET Qt${with_qt_version}::moc) message(FATAL_ERROR "Qt${with_qt_version}::moc not found") endif() -add_library(dummy STATIC example.cpp) -target_link_libraries(dummy Qt${with_qt_version}::Core - Qt${with_qt_version}::Widgets - Qt${with_qt_version}::Gui) - get_target_property(moc_location Qt${with_qt_version}::moc IMPORTED_LOCATION) set_target_properties(dummy PROPERTIES AUTOMOC_MOC_OPTIONS "EXE_PATH=${moc_location}") @@ -20,5 +12,4 @@ add_executable(mymoc $<$<CONFIG:Debug>:exe_debug.cpp> $<$<CONFIG:RelWithDebInfo>:exe_relwithdebinfo.cpp> ) -set_target_properties(dummy PROPERTIES AUTOMOC_EXECUTABLE $<TARGET_FILE:mymoc> - AUTOMOC ON) +set_target_properties(dummy PROPERTIES AUTOMOC_EXECUTABLE $<TARGET_FILE:mymoc>) diff --git a/Tests/RunCMake/Autogen/AutoRccExecutableConfig.cmake b/Tests/RunCMake/Autogen/AutoRccExecutableConfig.cmake index a0e9ce9..0e46420 100644 --- a/Tests/RunCMake/Autogen/AutoRccExecutableConfig.cmake +++ b/Tests/RunCMake/Autogen/AutoRccExecutableConfig.cmake @@ -1,17 +1,9 @@ -enable_language(CXX) - -set(CMAKE_CXX_STANDARD 11) -find_package(Qt${with_qt_version} REQUIRED COMPONENTS Core Widgets Gui) +include(RccExample.cmake) if(NOT TARGET Qt${with_qt_version}::rcc) message(FATAL_ERROR "Qt${with_qt_version}::rcc not found") endif() -add_library(dummy STATIC example.cpp data.qrc) -target_link_libraries(dummy Qt${with_qt_version}::Core - Qt${with_qt_version}::Widgets - Qt${with_qt_version}::Gui) - get_target_property(rcc_location Qt${with_qt_version}::rcc IMPORTED_LOCATION) set_target_properties(dummy PROPERTIES AUTORCC_OPTIONS "EXE_PATH=${rcc_location}") @@ -20,5 +12,4 @@ add_executable(myrcc $<$<CONFIG:Debug>:exe_debug.cpp> $<$<CONFIG:RelWithDebInfo>:exe_relwithdebinfo.cpp> ) -set_target_properties(dummy PROPERTIES AUTORCC_EXECUTABLE $<TARGET_FILE:myrcc> - AUTORCC ON) +set_target_properties(dummy PROPERTIES AUTORCC_EXECUTABLE $<TARGET_FILE:myrcc>) diff --git a/Tests/RunCMake/Autogen/AutoUicExecutableConfig.cmake b/Tests/RunCMake/Autogen/AutoUicExecutableConfig.cmake index ce7675e..55b88b8 100644 --- a/Tests/RunCMake/Autogen/AutoUicExecutableConfig.cmake +++ b/Tests/RunCMake/Autogen/AutoUicExecutableConfig.cmake @@ -1,17 +1,9 @@ -enable_language(CXX) - -set(CMAKE_CXX_STANDARD 11) -find_package(Qt${with_qt_version} REQUIRED COMPONENTS Core Widgets Gui) +include(UicExample.cmake) if(NOT TARGET Qt${with_qt_version}::uic) message(FATAL_ERROR "Qt${with_qt_version}::uic not found") endif() -add_library(dummy STATIC example_ui.cpp uiA.ui) -target_link_libraries(dummy Qt${with_qt_version}::Core - Qt${with_qt_version}::Widgets - Qt${with_qt_version}::Gui) - get_target_property(uic_location Qt${with_qt_version}::uic IMPORTED_LOCATION) set_target_properties(dummy PROPERTIES AUTOUIC_OPTIONS "EXE_PATH=${uic_location}") @@ -20,5 +12,4 @@ add_executable(myuic $<$<CONFIG:Debug>:exe_debug.cpp> $<$<CONFIG:RelWithDebInfo>:exe_relwithdebinfo.cpp> ) -set_target_properties(dummy PROPERTIES AUTOUIC_EXECUTABLE $<TARGET_FILE:myuic> - AUTOUIC ON) +set_target_properties(dummy PROPERTIES AUTOUIC_EXECUTABLE $<TARGET_FILE:myuic>) diff --git a/Tests/RunCMake/Autogen/MocExample.cmake b/Tests/RunCMake/Autogen/MocExample.cmake new file mode 100644 index 0000000..f06f8f6 --- /dev/null +++ b/Tests/RunCMake/Autogen/MocExample.cmake @@ -0,0 +1,11 @@ +enable_language(CXX) + +set(CMAKE_CXX_STANDARD 11) +find_package(Qt${with_qt_version} REQUIRED COMPONENTS Core Widgets Gui) + +add_library(dummy STATIC example.cpp) +target_link_libraries(dummy Qt${with_qt_version}::Core + Qt${with_qt_version}::Widgets + Qt${with_qt_version}::Gui) + +set_target_properties(dummy PROPERTIES AUTOMOC ON) diff --git a/Tests/RunCMake/Autogen/RccExample.cmake b/Tests/RunCMake/Autogen/RccExample.cmake new file mode 100644 index 0000000..4554eb0 --- /dev/null +++ b/Tests/RunCMake/Autogen/RccExample.cmake @@ -0,0 +1,11 @@ +enable_language(CXX) + +set(CMAKE_CXX_STANDARD 11) +find_package(Qt${with_qt_version} REQUIRED COMPONENTS Core Widgets Gui) + +add_library(dummy STATIC example.cpp data.qrc) +target_link_libraries(dummy Qt${with_qt_version}::Core + Qt${with_qt_version}::Widgets + Qt${with_qt_version}::Gui) + +set_target_properties(dummy PROPERTIES AUTORCC ON) diff --git a/Tests/RunCMake/Autogen/RunCMakeTest.cmake b/Tests/RunCMake/Autogen/RunCMakeTest.cmake index 12a8f8e..38987b9 100644 --- a/Tests/RunCMake/Autogen/RunCMakeTest.cmake +++ b/Tests/RunCMake/Autogen/RunCMakeTest.cmake @@ -126,50 +126,69 @@ if (DEFINED with_qt_version) if(RunCMake_GENERATOR MATCHES "Make|Ninja") block() if(QtCore_VERSION VERSION_GREATER_EQUAL 5.15.0) - set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/QtAutoMocDeps-build) - run_cmake(QtAutoMocDeps) - set(RunCMake_TEST_NO_CLEAN 1) - # Build the project. - run_cmake_command(QtAutoMocDeps-build ${CMAKE_COMMAND} --build . --verbose) - # Touch just the library source file, which shouldn't cause a rerun of AUTOMOC - # for app_with_qt target. - file(TOUCH "${RunCMake_SOURCE_DIR}/simple_lib.cpp") - set(RunCMake_TEST_NOT_EXPECT_stdout "Automatic MOC for target app_with_qt|\ + if (RunCMake_GENERATOR MATCHES "Ninja Multi-Config") + set(config_list Debug Release RelWithDebInfo) + else() + set(config_list single-config) + endif() + foreach(config IN ITEMS ${config_list}) + block() + if (config STREQUAL "single-config") + set(config_suffix "") + else() + set(config_suffix "_${config}") + endif() + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/QtAutoMocDeps${config_suffix}-build) + run_cmake(QtAutoMocDeps) + set(RunCMake_TEST_NO_CLEAN 1) + # Build the project. + if (config STREQUAL "single-config") + set(config_param "") + else() + set(config_param "--config ${config}") + endif() + run_cmake_command(QtAutoMocDeps-build ${CMAKE_COMMAND} --build . --verbose ${config_param}) + # Touch just the library source file, which shouldn't cause a rerun of AUTOMOC + # for app_with_qt target. + file(TOUCH "${RunCMake_SOURCE_DIR}/simple_lib.cpp") + set(RunCMake_TEST_NOT_EXPECT_stdout "Automatic MOC for target app_with_qt|\ Automatic MOC for target sub_exe_1|\ Automatic MOC for target sub_exe_2") - set(RunCMake_TEST_VARIANT_DESCRIPTION "-Don't execute AUTOMOC for 'app_with_qt', 'sub_exe_1' and 'sub_exe_2'") - # Build and assert that AUTOMOC was not run for app_with_qt, sub_exe_1 and sub_exe_2. - run_cmake_command(QtAutoMocDeps-build ${CMAKE_COMMAND} --build . --verbose) - unset(RunCMake_TEST_VARIANT_DESCRIPTION) - unset(RunCMake_TEST_NOT_EXPECT_stdout) - - macro(check_file_exists file) - if (EXISTS "${file}") - set(check_result "PASSED") - set(message_type "STATUS") - else() - set(check_result "FAILED") - set(message_type "FATAL_ERROR") - endif() - - message(${message_type} "QtAutoMocDeps-build-\"${file}\" was generated - ${check_result}") - endmacro() - - check_file_exists("${RunCMake_TEST_BINARY_DIR}/app_with_qt_autogen/deps") - check_file_exists("${RunCMake_TEST_BINARY_DIR}/QtSubDir1/sub_exe_1_autogen/deps") - check_file_exists("${RunCMake_TEST_BINARY_DIR}/QtSubDir2/sub_exe_2_autogen/deps") - - check_file_exists("${RunCMake_TEST_BINARY_DIR}/app_with_qt_autogen/timestamp") - check_file_exists("${RunCMake_TEST_BINARY_DIR}/QtSubDir1/sub_exe_1_autogen/timestamp") - check_file_exists("${RunCMake_TEST_BINARY_DIR}/QtSubDir2/sub_exe_2_autogen/timestamp") - - # Touch a header file to make sure an automoc dependency cycle is not introduced. - file(TOUCH "${RunCMake_SOURCE_DIR}/MyWindow.h") - set(RunCMake_TEST_VARIANT_DESCRIPTION "-First build after touch to detect dependency cycle") - run_cmake_command(QtAutoMocDeps-build ${CMAKE_COMMAND} --build . --verbose) - # Need to run a second time to hit the dependency cycle. - set(RunCMake_TEST_VARIANT_DESCRIPTION "-Don't hit dependency cycle") - run_cmake_command(QtAutoMocDeps-build ${CMAKE_COMMAND} --build . --verbose) + set(RunCMake_TEST_VARIANT_DESCRIPTION "-Don't execute AUTOMOC for 'app_with_qt', 'sub_exe_1' and 'sub_exe_2'") + # Build and assert that AUTOMOC was not run for app_with_qt, sub_exe_1 and sub_exe_2. + run_cmake_command(QtAutoMocDeps-build ${CMAKE_COMMAND} --build . --verbose ${config_param}) + unset(RunCMake_TEST_VARIANT_DESCRIPTION) + unset(RunCMake_TEST_NOT_EXPECT_stdout) + + macro(check_file_exists file) + if (EXISTS "${file}") + set(check_result "PASSED") + set(message_type "STATUS") + else() + set(check_result "FAILED") + set(message_type "FATAL_ERROR") + endif() + + message(${message_type} "QtAutoMocDeps-build-\"${file}\" was generated - ${check_result}") + endmacro() + + check_file_exists("${RunCMake_TEST_BINARY_DIR}/app_with_qt_autogen/deps${config_suffix}") + check_file_exists("${RunCMake_TEST_BINARY_DIR}/QtSubDir1/sub_exe_1_autogen/deps${config_suffix}") + check_file_exists("${RunCMake_TEST_BINARY_DIR}/QtSubDir2/sub_exe_2_autogen/deps${config_suffix}") + + check_file_exists("${RunCMake_TEST_BINARY_DIR}/app_with_qt_autogen/timestamp${config_suffix}") + check_file_exists("${RunCMake_TEST_BINARY_DIR}/QtSubDir1/sub_exe_1_autogen/timestamp${config_suffix}") + check_file_exists("${RunCMake_TEST_BINARY_DIR}/QtSubDir2/sub_exe_2_autogen/timestamp${config_suffix}") + + # Touch a header file to make sure an automoc dependency cycle is not introduced. + file(TOUCH "${RunCMake_SOURCE_DIR}/MyWindow.h") + set(RunCMake_TEST_VARIANT_DESCRIPTION "-First build after touch to detect dependency cycle") + run_cmake_command(QtAutoMocDeps-build ${CMAKE_COMMAND} --build . --verbose) + # Need to run a second time to hit the dependency cycle. + set(RunCMake_TEST_VARIANT_DESCRIPTION "-Don't hit dependency cycle") + run_cmake_command(QtAutoMocDeps-build ${CMAKE_COMMAND} --build . --verbose) + endblock() + endforeach() endif() endblock() endif() @@ -239,6 +258,16 @@ ${make_program_stderr} endif() endfunction() + function(expect_n_times string_to_check expected_output expected_count test_name) + count_substring("${string_to_check}" "${expected_output}" count) + if(NOT count EQUAL ${expected_count}) + message(STATUS "${test_name}-expect_${expected_count}_times - FAILED") + message(FATAL_ERROR "Expected to find ${expected_output} exactly ${expected_count} times in ${string_to_check} but found ${count} occurrences of ${expected_output}") + else() + message(STATUS "${test_name}-expect_${expected_count}_times - PASSED") + endif() + endfunction() + function(not_expect make_program_stdout unexpected_output test_name) count_substring("${make_program_stdout}" "${unexpected_output}" count) if(NOT count EQUAL 0) @@ -253,6 +282,27 @@ ${make_program_stderr} foreach(exe IN ITEMS Moc Uic Rcc) if(RunCMake_GENERATOR MATCHES "Ninja Multi-Config") block() + set(RunCMake_TEST_VARIANT_DESCRIPTION "-CMake-configure") + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Auto${exe}ExecutableConfig-multi-config-build) + run_cmake_with_options(Auto${exe}ExecutableConfig ${RunCMake_TEST_OPTIONS} -DCMAKE_AUTOGEN_VERBOSE=ON) + unset(RunCMake_TEST_VARIANT_DESCRIPTION) + set(RunCMake_TEST_NO_CLEAN 1) + foreach(config IN ITEMS Debug Release RelWithDebInfo) + block() + set(RunCMake_TEST_EXPECT_stdout ".*running_exe_${config}*") + set(RunCMake_TEST_VARIANT_DESCRIPTION "-${config}-expect_running_exe_${config}") + run_cmake_command(Auto${exe}ExecutableConfig-multi-config-build ${CMAKE_COMMAND} --build . --config ${config}) + endblock() + endforeach() + set(RunCMake_TEST_EXPECT_stdout "ninja: no work to do") + foreach(config IN ITEMS Debug Release RelWithDebInfo) + block() + set(RunCMake_TEST_VARIANT_DESCRIPTION "-${config}-expect_no_work_to_do") + run_cmake_command(Auto${exe}ExecutableConfig-multi-config-build ${CMAKE_COMMAND} --build . --config ${config}) + endblock() + endforeach() + endblock() + block() set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Auto${exe}ExecutableConfig-build) run_cmake_with_options(Auto${exe}ExecutableConfig ${RunCMake_TEST_OPTIONS} -DCMAKE_AUTOGEN_VERBOSE=ON) foreach(config IN ITEMS Debug Release RelWithDebInfo) @@ -337,4 +387,71 @@ ${make_program_stderr} endif() endforeach() endif() + + # Visual Studio specific dependency tests + if (RunCMake_GENERATOR MATCHES "Visual Studio") + foreach(exe IN ITEMS Moc Uic Rcc) + block() + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${exe}Example-build) + set(RunCMake_TEST_VARIANT_DESCRIPTION "-CMake-configure") + run_cmake_with_options(${exe}Example ${RunCMake_TEST_OPTIONS} -DCMAKE_AUTOGEN_VERBOSE=ON) + unset(RunCMake_TEST_VARIANT_DESCRIPTION) + set(RunCMake_TEST_NO_CLEAN 1) + foreach(config IN ITEMS Debug Release RelWithDebInfo) + block() + set(RunCMake_TEST_VARIANT_DESCRIPTION "-${config}-first-build") + run_cmake_command(${exe}Example-build ${CMAKE_COMMAND} --build . --config ${config}) + endblock() + endforeach() + foreach(config IN ITEMS Debug Release RelWithDebInfo) + block() + if (exe STREQUAL "Moc" OR exe STREQUAL "Uic") + set(RunCMake_TEST_NOT_EXPECT_stdout "Auto${exe}") + set(not_expect_descripton "Auto${exe}") + else () + set(RunCMake_TEST_NOT_EXPECT_stdout "qrc_data.cpp|Auto${exe}") + set(not_expect_descripton "qrc_data.cpp_and_Auto${exe}") + endif() + set(RunCMake_TEST_VARIANT_DESCRIPTION "-second-build-${config}_expect_no_${not_expect_descripton}") + run_cmake_command(${exe}Example-build ${CMAKE_COMMAND} --build . --config ${config}) + endblock() + endforeach() + endblock() + endforeach() + endif() + + if (RunCMake_GENERATOR MATCHES "Xcode") + foreach(exe IN ITEMS Moc Uic Rcc) + block() + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${exe}Example-build) + set(RunCMake_TEST_VARIANT_DESCRIPTION "-CMake-configure") + set(RunCMake_TEST_EXPECT_stderr ".*") + run_cmake_with_options(${exe}Example ${RunCMake_TEST_OPTIONS} -DCMAKE_AUTOGEN_VERBOSE=ON) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_MAKE_PROGRAM ${CMAKE_COMMAND}) + run_make_program(${RunCMake_TEST_BINARY_DIR} --build . --config Debug) + if (exe STREQUAL "Moc") + set(expected_count 16) + elseif (exe STREQUAL "Uic") + set(expected_count 4) + else() + set(expected_count 12) + endif() + expect_n_times("${make_program_stdout}" "Auto${exe}:" ${expected_count} "${exe}Example-build-Auto${exe}") + expect_n_times("${make_program_stdout}" "Auto${exe}:" ${expected_count} "${exe}Example-build-Auto${exe}") + + if (exe STREQUAL "Moc" OR exe STREQUAL "Uic") + expect_n_times("${make_program_stdout}" "AutoGen:" 20 "${exe}Example-build-AutoGen:") + endif() + + foreach(config IN ITEMS Debug Release RelWithDebInfo) + block() + run_make_program(${RunCMake_TEST_BINARY_DIR} --build . --config ${config}) + not_expect("${make_program_stdout}" "Auto${exe}" "${exe}Example-${config}_Auto${exe}") + not_expect("${make_program_stdout}" "AutoGen:" "${exe}Example-${config}_AutoGen") + endblock() + endforeach() + endblock() + endforeach() + endif() endif () diff --git a/Tests/RunCMake/Autogen/UicExample.cmake b/Tests/RunCMake/Autogen/UicExample.cmake new file mode 100644 index 0000000..4b1f8c1 --- /dev/null +++ b/Tests/RunCMake/Autogen/UicExample.cmake @@ -0,0 +1,11 @@ +enable_language(CXX) + +set(CMAKE_CXX_STANDARD 11) +find_package(Qt${with_qt_version} REQUIRED COMPONENTS Core Widgets Gui) + +add_library(dummy STATIC example_ui.cpp uiA.ui) +target_link_libraries(dummy Qt${with_qt_version}::Core + Qt${with_qt_version}::Widgets + Qt${with_qt_version}::Gui) + +set_target_properties(dummy PROPERTIES AUTOUIC ON) diff --git a/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-stderr.txt b/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-stderr.txt index 7230a07..07c17e2 100644 --- a/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-stderr.txt +++ b/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-stderr.txt @@ -6,7 +6,7 @@ Some library files are in directories implicitly searched by the linker when invoked for C: - .*/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-build/lib/(lib)?CMP0060.(a|lib) + .*/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-build/lib/(lib)?CMP0060.(a|lib|l) For compatibility with older versions of CMake, the generated link line will ask the linker to search for these by library name. diff --git a/Tests/RunCMake/CMP0119/RunCMakeTest.cmake b/Tests/RunCMake/CMP0119/RunCMakeTest.cmake index 7395827..2576a28 100644 --- a/Tests/RunCMake/CMP0119/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMP0119/RunCMakeTest.cmake @@ -8,10 +8,10 @@ function(run_CMP0119 status) endfunction() if(NOT RunCMake_GENERATOR MATCHES "Visual Studio|Xcode" AND - NOT CMAKE_C_COMPILER_ID MATCHES "(Borland|Embarcadero|Watcom)") + NOT CMAKE_C_COMPILER_ID MATCHES "(Borland|Embarcadero|Watcom|OrangeC)") run_CMP0119(WARN) run_CMP0119(OLD) endif() -if((CMAKE_C_COMPILER_ID MATCHES "(GNU|LCC|Clang|MSVC|Borland|Embarcadero|Intel|TI)")) +if((CMAKE_C_COMPILER_ID MATCHES "(GNU|LCC|Clang|MSVC|Borland|Embarcadero|Intel|TI|OrangeC)")) run_CMP0119(NEW) endif() diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 56952e2..4387c5b 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -201,6 +201,7 @@ elseif(CMake_TEST_Qt5) endif() if(CMAKE_GENERATOR MATCHES "Ninja") set(Ninja_ARGS + -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID} -DCMAKE_C_OUTPUT_EXTENSION=${CMAKE_C_OUTPUT_EXTENSION} -DCMAKE_SHARED_LIBRARY_PREFIX=${CMAKE_SHARED_LIBRARY_PREFIX} -DCMAKE_SHARED_LIBRARY_SUFFIX=${CMAKE_SHARED_LIBRARY_SUFFIX}) @@ -398,6 +399,7 @@ add_RunCMake_test(GenEx-PATH) add_RunCMake_test(GenEx-PATH_EQUAL) add_RunCMake_test(GenEx-LIST) add_RunCMake_test(GeneratorExpression) +add_RunCMake_test(GeneratorExpressionShortCircuit) add_RunCMake_test(GeneratorInstance) add_RunCMake_test(GeneratorPlatform) if(XCODE_VERSION) @@ -720,7 +722,7 @@ if((CMAKE_C_COMPILER_ID STREQUAL "AppleClang" set(CMake_TEST_XcFramework ON) endif() if(CMake_TEST_XcFramework AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 11.0) - set(XcFramework_ARGS -DCMAKE_C_COMPILER_VERSION=${CMAKE_C_COMPILER_VERSION}) + set(XcFramework_ARGS -DCMake_TEST_XCODE_VERSION=${CMake_TEST_XCODE_VERSION}) add_RunCMake_test(XcFramework) # This test can take a very long time due to lots of combinations. diff --git a/Tests/RunCMake/CXXModules/NinjaDependInfoBMIInstall-check.cmake b/Tests/RunCMake/CXXModules/NinjaDependInfoBMIInstall-check.cmake index 0d08c44..6de2e1e 100644 --- a/Tests/RunCMake/CXXModules/NinjaDependInfoBMIInstall-check.cmake +++ b/Tests/RunCMake/CXXModules/NinjaDependInfoBMIInstall-check.cmake @@ -2,19 +2,19 @@ include("${CMAKE_CURRENT_LIST_DIR}/check-json.cmake") if (RunCMake_GENERATOR_IS_MULTI_CONFIG) set(have_file 0) - foreach (config IN ITEMS Release Debug RelWithDebInfo MinSizeRel) - if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-bmi-install-public.dir/${config}/CXXDependInfo.json") + foreach (CXXModules_config IN ITEMS Release Debug RelWithDebInfo MinSizeRel) + if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-bmi-install-public.dir/${CXXModules_config}/CXXDependInfo.json") continue () endif () set(have_file 1) - set(CMAKE_BUILD_TYPE "${config}") + set(CMAKE_BUILD_TYPE "${CXXModules_config}") - file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-bmi-install-public.dir/${config}/CXXDependInfo.json" actual_contents) + file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-bmi-install-public.dir/${CXXModules_config}/CXXDependInfo.json" actual_contents) file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoBMIInstall-public.json" expect_contents) check_json("${actual_contents}" "${expect_contents}") - file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-bmi-install-private.dir/${config}/CXXDependInfo.json" actual_contents) + file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-bmi-install-private.dir/${CXXModules_config}/CXXDependInfo.json" actual_contents) file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoBMIInstall-private.json" expect_contents) check_json("${actual_contents}" "${expect_contents}") endforeach () @@ -24,6 +24,9 @@ if (RunCMake_GENERATOR_IS_MULTI_CONFIG) "No recognized build configurations found.") endif () else () + set(CXXModules_config "${CXXModules_default_build_type}") + set(CMAKE_BUILD_TYPE "${CXXModules_default_build_type}") + file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-bmi-install-public.dir/CXXDependInfo.json" actual_contents) file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoBMIInstall-public.json" expect_contents) check_json("${actual_contents}" "${expect_contents}") @@ -32,3 +35,5 @@ else () file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoBMIInstall-private.json" expect_contents) check_json("${actual_contents}" "${expect_contents}") endif () + +string(REPLACE ";" "\n " RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}") diff --git a/Tests/RunCMake/CXXModules/NinjaDependInfoExport-check.cmake b/Tests/RunCMake/CXXModules/NinjaDependInfoExport-check.cmake index 7720257..0c933c9 100644 --- a/Tests/RunCMake/CXXModules/NinjaDependInfoExport-check.cmake +++ b/Tests/RunCMake/CXXModules/NinjaDependInfoExport-check.cmake @@ -2,19 +2,19 @@ include("${CMAKE_CURRENT_LIST_DIR}/check-json.cmake") if (RunCMake_GENERATOR_IS_MULTI_CONFIG) set(have_file 0) - foreach (config IN ITEMS Release Debug RelWithDebInfo MinSizeRel) - if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-exports-public.dir/${config}/CXXDependInfo.json") + foreach (CXXModules_config IN ITEMS Release Debug RelWithDebInfo MinSizeRel) + if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-exports-public.dir/${CXXModules_config}/CXXDependInfo.json") continue () endif () set(have_file 1) - set(CMAKE_BUILD_TYPE "${config}") + set(CMAKE_BUILD_TYPE "${CXXModules_config}") - file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-exports-public.dir/${config}/CXXDependInfo.json" actual_contents) + file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-exports-public.dir/${CXXModules_config}/CXXDependInfo.json" actual_contents) file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoExport-public.json" expect_contents) check_json("${actual_contents}" "${expect_contents}") - file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-exports-private.dir/${config}/CXXDependInfo.json" actual_contents) + file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-exports-private.dir/${CXXModules_config}/CXXDependInfo.json" actual_contents) file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoExport-private.json" expect_contents) check_json("${actual_contents}" "${expect_contents}") endforeach () @@ -24,6 +24,9 @@ if (RunCMake_GENERATOR_IS_MULTI_CONFIG) "No recognized build configurations found.") endif () else () + set(CXXModules_config "${CXXModules_default_build_type}") + set(CMAKE_BUILD_TYPE "${CXXModules_default_build_type}") + file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-exports-public.dir/CXXDependInfo.json" actual_contents) file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoExport-public.json" expect_contents) check_json("${actual_contents}" "${expect_contents}") @@ -32,3 +35,5 @@ else () file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoExport-private.json" expect_contents) check_json("${actual_contents}" "${expect_contents}") endif () + +string(REPLACE ";" "\n " RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}") diff --git a/Tests/RunCMake/CXXModules/NinjaDependInfoFileSet-check.cmake b/Tests/RunCMake/CXXModules/NinjaDependInfoFileSet-check.cmake index b9a1315..4eaa891 100644 --- a/Tests/RunCMake/CXXModules/NinjaDependInfoFileSet-check.cmake +++ b/Tests/RunCMake/CXXModules/NinjaDependInfoFileSet-check.cmake @@ -2,19 +2,19 @@ include("${CMAKE_CURRENT_LIST_DIR}/check-json.cmake") if (RunCMake_GENERATOR_IS_MULTI_CONFIG) set(have_file 0) - foreach (config IN ITEMS Release Debug RelWithDebInfo MinSizeRel) - if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-file-sets-public.dir/${config}/CXXDependInfo.json") + foreach (CXXModules_config IN ITEMS Release Debug RelWithDebInfo MinSizeRel) + if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-file-sets-public.dir/${CXXModules_config}/CXXDependInfo.json") continue () endif () set(have_file 1) - set(CMAKE_BUILD_TYPE "${config}") + set(CMAKE_BUILD_TYPE "${CXXModules_config}") - file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-file-sets-public.dir/${config}/CXXDependInfo.json" actual_contents) + file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-file-sets-public.dir/${CXXModules_config}/CXXDependInfo.json" actual_contents) file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoFileSet-public.json" expect_contents) check_json("${actual_contents}" "${expect_contents}") - file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-file-sets-private.dir/${config}/CXXDependInfo.json" actual_contents) + file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-file-sets-private.dir/${CXXModules_config}/CXXDependInfo.json" actual_contents) file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoFileSet-private.json" expect_contents) check_json("${actual_contents}" "${expect_contents}") endforeach () @@ -24,6 +24,9 @@ if (RunCMake_GENERATOR_IS_MULTI_CONFIG) "No recognized build configurations found.") endif () else () + set(CXXModules_config "${CXXModules_default_build_type}") + set(CMAKE_BUILD_TYPE "${CXXModules_default_build_type}") + file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-file-sets-public.dir/CXXDependInfo.json" actual_contents) file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoFileSet-public.json" expect_contents) check_json("${actual_contents}" "${expect_contents}") @@ -32,3 +35,5 @@ else () file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoFileSet-private.json" expect_contents) check_json("${actual_contents}" "${expect_contents}") endif () + +string(REPLACE ";" "\n " RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}") diff --git a/Tests/RunCMake/CXXModules/check-json.cmake b/Tests/RunCMake/CXXModules/check-json.cmake index 19d0c8a..bb04b36 100644 --- a/Tests/RunCMake/CXXModules/check-json.cmake +++ b/Tests/RunCMake/CXXModules/check-json.cmake @@ -2,19 +2,20 @@ cmake_policy(PUSH) cmake_policy(SET CMP0057 NEW) function (json_placeholders in out) - string(REPLACE "<CONFIG>" "${CMAKE_BUILD_TYPE}" in "${in}") + string(REPLACE "<CONFIG>" "${CXXModules_config}" in "${in}") if (RunCMake_GENERATOR_IS_MULTI_CONFIG) - string(REPLACE "<CONFIG_DIR>" "${CMAKE_BUILD_TYPE}/" in "${in}") + string(REPLACE "<CONFIG_DIR>" "/${CXXModules_config}" in "${in}") else () string(REPLACE "<CONFIG_DIR>" "" in "${in}") endif () if (CMAKE_BUILD_TYPE) - string(REPLACE "<CONFIG_FORCE>" "${CMAKE_BUILD_TYPE}" in "${in}") + string(REPLACE "<CONFIG_FORCE>" "${CXXModules_config}" in "${in}") else () string(REPLACE "<CONFIG_FORCE>" "noconfig" in "${in}") endif () string(REPLACE "<SOURCE_DIR>" "${RunCMake_SOURCE_DIR}" in "${in}") string(REPLACE "<BINARY_DIR>" "${RunCMake_TEST_BINARY_DIR}" in "${in}") + string(REPLACE "<OBJEXT>" "${CMAKE_CXX_OUTPUT_EXTENSION}" in "${in}") set("${out}" "${in}" PARENT_SCOPE) endfunction () @@ -22,6 +23,7 @@ function (check_json_value path actual_type expect_type actual_value expect_valu if (NOT actual_type STREQUAL expect_type) list(APPEND RunCMake_TEST_FAILED "Type mismatch at ${path}: ${actual_type} vs. ${expect_type}") + set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE) return () endif () @@ -53,6 +55,8 @@ function (check_json_value path actual_type expect_type actual_value expect_valu elseif (actual_type STREQUAL OBJECT) check_json_object("${path}" "${actual_value}" "${expect_value}") endif () + + set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE) endfunction () # Check that two arrays are the same. @@ -82,6 +86,8 @@ function (check_json_array path actual expect) string(JSON expect_value GET "${expect}" "${idx}") check_json_value("${new_path}" "${actual_type}" "${expect_type}" "${actual_value}" "${expect_value}") endforeach () + + set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE) endfunction () # Check that two inner objects are the same. @@ -131,12 +137,12 @@ function (check_json_object path actual expect) if (actual_keys_missed) string(REPLACE ";" ", " actual_keys_missed_text "${actual_keys_missed}") list(APPEND RunCMake_TEST_FAILED - "Missing expected members at ${path}: ${actual_keys_missed_text}") + "Extra unexpected members at ${path}: ${actual_keys_missed_text}") endif () if (expect_keys_missed) string(REPLACE ";" ", " expect_keys_missed_text "${expect_keys_missed}") list(APPEND RunCMake_TEST_FAILED - "Extra unexpected members at ${path}: ${expect_keys_missed_text}") + "Missing expected members at ${path}: ${expect_keys_missed_text}") endif () foreach (key IN LISTS common_keys) @@ -148,13 +154,15 @@ function (check_json_object path actual expect) string(JSON expect_value GET "${expect}" "${key}") check_json_value("${new_path}" "${actual_type}" "${expect_type}" "${actual_value}" "${expect_value}") endforeach () + + set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE) endfunction () # Check that two JSON objects are the same. function (check_json actual expect) check_json_object("" "${actual}" "${expect}") -endfunction () -string(REPLACE ";" "; " RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}") + set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE) +endfunction () cmake_policy(POP) diff --git a/Tests/RunCMake/CXXModules/compiler_introspection.cmake b/Tests/RunCMake/CXXModules/compiler_introspection.cmake index 0e61383..8c74940 100644 --- a/Tests/RunCMake/CXXModules/compiler_introspection.cmake +++ b/Tests/RunCMake/CXXModules/compiler_introspection.cmake @@ -21,6 +21,8 @@ set(CMAKE_CXX_COMPILE_FEATURES \"${CMAKE_CXX_COMPILE_FEATURES}\") set(CMAKE_MAKE_PROGRAM \"${CMAKE_MAKE_PROGRAM}\") set(forced_cxx_standard \"${forced_cxx_standard}\") set(CMAKE_CXX_COMPILER_VERSION \"${CMAKE_CXX_COMPILER_VERSION}\") +set(CMAKE_CXX_OUTPUT_EXTENSION \"${CMAKE_CXX_OUTPUT_EXTENSION}\") +set(CXXModules_default_build_type \"${CMAKE_BUILD_TYPE}\") ") file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/info.cmake" "${info}") diff --git a/Tests/RunCMake/CXXModules/expect/NinjaDependInfoBMIInstall-private.json b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoBMIInstall-private.json index 65f0759..45b0396 100644 --- a/Tests/RunCMake/CXXModules/expect/NinjaDependInfoBMIInstall-private.json +++ b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoBMIInstall-private.json @@ -6,9 +6,12 @@ "script-location": "<BINARY_DIR>/CMakeFiles/ninja-bmi-install-private.dir/install-cxx-module-bmi-<CONFIG_FORCE>.cmake" }, "compiler-id": "<IGNORE>", + "compiler-frontend-variant": "<IGNORE>", + "compiler-simulate-id": "<IGNORE>", "config": "<CONFIG>", "cxx-modules": { - "CMakeFiles/ninja-bmi-install-private.dir/sources/module-internal-part.cxx.o": { + "CMakeFiles/ninja-bmi-install-private.dir<CONFIG_DIR>/sources/module-internal-part.cxx<OBJEXT>": { + "bmi-only": false, "destination": null, "name": "internal_partitions", "relative-directory": "sources", @@ -16,7 +19,8 @@ "type": "CXX_MODULES", "visibility": "PRIVATE" }, - "CMakeFiles/ninja-bmi-install-private.dir/sources/module-part.cxx.o": { + "CMakeFiles/ninja-bmi-install-private.dir<CONFIG_DIR>/sources/module-part.cxx<OBJEXT>": { + "bmi-only": false, "destination": null, "name": "modules", "relative-directory": "", @@ -24,7 +28,8 @@ "type": "CXX_MODULES", "visibility": "PRIVATE" }, - "CMakeFiles/ninja-bmi-install-private.dir/sources/module.cxx.o": { + "CMakeFiles/ninja-bmi-install-private.dir<CONFIG_DIR>/sources/module.cxx<OBJEXT>": { + "bmi-only": false, "destination": null, "name": "modules", "relative-directory": "", @@ -41,5 +46,5 @@ "include-dirs": [], "language": "CXX", "linked-target-dirs": [], - "module-dir": "<BINARY_DIR>/CMakeFiles/ninja-bmi-install-private.dir" + "module-dir": "<BINARY_DIR>/CMakeFiles/ninja-bmi-install-private.dir<CONFIG_DIR>" } diff --git a/Tests/RunCMake/CXXModules/expect/NinjaDependInfoBMIInstall-public.json b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoBMIInstall-public.json index 9c8a895..30b55e3 100644 --- a/Tests/RunCMake/CXXModules/expect/NinjaDependInfoBMIInstall-public.json +++ b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoBMIInstall-public.json @@ -3,12 +3,15 @@ "destination": "lib/cxx/modules/<CONFIG>", "message-level": "", "permissions": "", - "script-location": "<BINARY_DIR>/CMakeFiles/ninja-bmi-install-public.dir/install-cxx-module-bmi-noconfig.cmake" + "script-location": "<BINARY_DIR>/CMakeFiles/ninja-bmi-install-public.dir/install-cxx-module-bmi-<CONFIG_FORCE>.cmake" }, "compiler-id": "<IGNORE>", + "compiler-frontend-variant": "<IGNORE>", + "compiler-simulate-id": "<IGNORE>", "config": "<CONFIG>", "cxx-modules": { - "CMakeFiles/ninja-bmi-install-public.dir/sources/module-internal-part.cxx.o": { + "CMakeFiles/ninja-bmi-install-public.dir<CONFIG_DIR>/sources/module-internal-part.cxx<OBJEXT>": { + "bmi-only": false, "destination": "lib/cxx/internals", "name": "internal_partitions", "relative-directory": "sources", @@ -16,7 +19,8 @@ "type": "CXX_MODULES", "visibility": "PUBLIC" }, - "CMakeFiles/ninja-bmi-install-public.dir/sources/module-part.cxx.o": { + "CMakeFiles/ninja-bmi-install-public.dir<CONFIG_DIR>/sources/module-part.cxx<OBJEXT>": { + "bmi-only": false, "destination": "lib/cxx", "name": "modules", "relative-directory": "", @@ -24,7 +28,8 @@ "type": "CXX_MODULES", "visibility": "PUBLIC" }, - "CMakeFiles/ninja-bmi-install-public.dir/sources/module.cxx.o": { + "CMakeFiles/ninja-bmi-install-public.dir<CONFIG_DIR>/sources/module.cxx<OBJEXT>": { + "bmi-only": false, "destination": "lib/cxx", "name": "modules", "relative-directory": "", @@ -41,5 +46,5 @@ "include-dirs": [], "language": "CXX", "linked-target-dirs": [], - "module-dir": "<BINARY_DIR>/CMakeFiles/ninja-bmi-install-public.dir" + "module-dir": "<BINARY_DIR>/CMakeFiles/ninja-bmi-install-public.dir<CONFIG_DIR>" } diff --git a/Tests/RunCMake/CXXModules/expect/NinjaDependInfoExport-private.json b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoExport-private.json index 0545981..f06a846 100644 --- a/Tests/RunCMake/CXXModules/expect/NinjaDependInfoExport-private.json +++ b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoExport-private.json @@ -1,9 +1,12 @@ { "bmi-installation": null, "compiler-id": "<IGNORE>", + "compiler-frontend-variant": "<IGNORE>", + "compiler-simulate-id": "<IGNORE>", "config": "<CONFIG>", "cxx-modules": { - "CMakeFiles/ninja-exports-private.dir/sources/module-internal-part.cxx.o": { + "CMakeFiles/ninja-exports-private.dir<CONFIG_DIR>/sources/module-internal-part.cxx<OBJEXT>": { + "bmi-only": false, "destination": null, "name": "internal_partitions", "relative-directory": "sources", @@ -11,7 +14,8 @@ "type": "CXX_MODULES", "visibility": "PRIVATE" }, - "CMakeFiles/ninja-exports-private.dir/sources/module-part.cxx.o": { + "CMakeFiles/ninja-exports-private.dir<CONFIG_DIR>/sources/module-part.cxx<OBJEXT>": { + "bmi-only": false, "destination": null, "name": "modules", "relative-directory": "", @@ -19,7 +23,8 @@ "type": "CXX_MODULES", "visibility": "PRIVATE" }, - "CMakeFiles/ninja-exports-private.dir/sources/module.cxx.o": { + "CMakeFiles/ninja-exports-private.dir<CONFIG_DIR>/sources/module.cxx<OBJEXT>": { + "bmi-only": false, "destination": null, "name": "modules", "relative-directory": "", @@ -69,5 +74,5 @@ "include-dirs": [], "language": "CXX", "linked-target-dirs": [], - "module-dir": "<BINARY_DIR>/CMakeFiles/ninja-exports-private.dir" + "module-dir": "<BINARY_DIR>/CMakeFiles/ninja-exports-private.dir<CONFIG_DIR>" } diff --git a/Tests/RunCMake/CXXModules/expect/NinjaDependInfoExport-public.json b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoExport-public.json index adc3ae3..938481c 100644 --- a/Tests/RunCMake/CXXModules/expect/NinjaDependInfoExport-public.json +++ b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoExport-public.json @@ -1,9 +1,12 @@ { "bmi-installation": null, "compiler-id": "<IGNORE>", + "compiler-frontend-variant": "<IGNORE>", + "compiler-simulate-id": "<IGNORE>", "config": "<CONFIG>", "cxx-modules": { - "CMakeFiles/ninja-exports-public.dir/sources/module-internal-part.cxx.o": { + "CMakeFiles/ninja-exports-public.dir<CONFIG_DIR>/sources/module-internal-part.cxx<OBJEXT>": { + "bmi-only": false, "destination": "lib/cxx/internals", "name": "internal_partitions", "relative-directory": "sources", @@ -11,7 +14,8 @@ "type": "CXX_MODULES", "visibility": "PUBLIC" }, - "CMakeFiles/ninja-exports-public.dir/sources/module-part.cxx.o": { + "CMakeFiles/ninja-exports-public.dir<CONFIG_DIR>/sources/module-part.cxx<OBJEXT>": { + "bmi-only": false, "destination": "lib/cxx", "name": "modules", "relative-directory": "", @@ -19,7 +23,8 @@ "type": "CXX_MODULES", "visibility": "PUBLIC" }, - "CMakeFiles/ninja-exports-public.dir/sources/module.cxx.o": { + "CMakeFiles/ninja-exports-public.dir<CONFIG_DIR>/sources/module.cxx<OBJEXT>": { + "bmi-only": false, "destination": "lib/cxx", "name": "modules", "relative-directory": "", @@ -69,5 +74,5 @@ "include-dirs": [], "language": "CXX", "linked-target-dirs": [], - "module-dir": "<BINARY_DIR>/CMakeFiles/ninja-exports-public.dir" + "module-dir": "<BINARY_DIR>/CMakeFiles/ninja-exports-public.dir<CONFIG_DIR>" } diff --git a/Tests/RunCMake/CXXModules/expect/NinjaDependInfoFileSet-private.json b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoFileSet-private.json index 9ba6568..3a66a94 100644 --- a/Tests/RunCMake/CXXModules/expect/NinjaDependInfoFileSet-private.json +++ b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoFileSet-private.json @@ -1,9 +1,12 @@ { "bmi-installation": null, "compiler-id": "<IGNORE>", + "compiler-frontend-variant": "<IGNORE>", + "compiler-simulate-id": "<IGNORE>", "config": "<CONFIG>", "cxx-modules": { - "CMakeFiles/ninja-file-sets-private.dir/sources/module-internal-part.cxx.o": { + "CMakeFiles/ninja-file-sets-private.dir<CONFIG_DIR>/sources/module-internal-part.cxx<OBJEXT>": { + "bmi-only": false, "destination": null, "name": "internal_partitions", "relative-directory": "sources", @@ -11,7 +14,8 @@ "type": "CXX_MODULES", "visibility": "PRIVATE" }, - "CMakeFiles/ninja-file-sets-private.dir/sources/module-part.cxx.o": { + "CMakeFiles/ninja-file-sets-private.dir<CONFIG_DIR>/sources/module-part.cxx<OBJEXT>": { + "bmi-only": false, "destination": null, "name": "modules", "relative-directory": "", @@ -19,7 +23,8 @@ "type": "CXX_MODULES", "visibility": "PRIVATE" }, - "CMakeFiles/ninja-file-sets-private.dir/sources/module.cxx.o": { + "CMakeFiles/ninja-file-sets-private.dir<CONFIG_DIR>/sources/module.cxx<OBJEXT>": { + "bmi-only": false, "destination": null, "name": "modules", "relative-directory": "", @@ -36,5 +41,5 @@ "include-dirs": [], "language": "CXX", "linked-target-dirs": [], - "module-dir": "<BINARY_DIR>/CMakeFiles/ninja-file-sets-private.dir" + "module-dir": "<BINARY_DIR>/CMakeFiles/ninja-file-sets-private.dir<CONFIG_DIR>" } diff --git a/Tests/RunCMake/CXXModules/expect/NinjaDependInfoFileSet-public.json b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoFileSet-public.json index 46e2cbf..ac06c0f 100644 --- a/Tests/RunCMake/CXXModules/expect/NinjaDependInfoFileSet-public.json +++ b/Tests/RunCMake/CXXModules/expect/NinjaDependInfoFileSet-public.json @@ -1,9 +1,12 @@ { "bmi-installation": null, "compiler-id": "<IGNORE>", + "compiler-frontend-variant": "<IGNORE>", + "compiler-simulate-id": "<IGNORE>", "config": "<CONFIG>", "cxx-modules": { - "CMakeFiles/ninja-file-sets-public.dir/<CONFIG_DIR>sources/module-internal-part.cxx.o": { + "CMakeFiles/ninja-file-sets-public.dir<CONFIG_DIR>/sources/module-internal-part.cxx<OBJEXT>": { + "bmi-only": false, "destination": "lib/cxx/internals", "name": "internal_partitions", "relative-directory": "sources", @@ -11,7 +14,8 @@ "type": "CXX_MODULES", "visibility": "PUBLIC" }, - "CMakeFiles/ninja-file-sets-public.dir/<CONFIG_DIR>sources/module-part.cxx.o": { + "CMakeFiles/ninja-file-sets-public.dir<CONFIG_DIR>/sources/module-part.cxx<OBJEXT>": { + "bmi-only": false, "destination": "lib/cxx", "name": "modules", "relative-directory": "", @@ -19,7 +23,8 @@ "type": "CXX_MODULES", "visibility": "PUBLIC" }, - "CMakeFiles/ninja-file-sets-public.dir/<CONFIG_DIR>sources/module.cxx.o": { + "CMakeFiles/ninja-file-sets-public.dir<CONFIG_DIR>/sources/module.cxx<OBJEXT>": { + "bmi-only": false, "destination": "lib/cxx", "name": "modules", "relative-directory": "", @@ -36,5 +41,5 @@ "include-dirs": [], "language": "CXX", "linked-target-dirs": [], - "module-dir": "<BINARY_DIR>/CMakeFiles/ninja-file-sets-public.dir" + "module-dir": "<BINARY_DIR>/CMakeFiles/ninja-file-sets-public.dir<CONFIG_DIR>" } diff --git a/Tests/RunCMake/FetchContent/ExcludeFromAll.cmake b/Tests/RunCMake/FetchContent/ExcludeFromAll.cmake new file mode 100644 index 0000000..376f2eb --- /dev/null +++ b/Tests/RunCMake/FetchContent/ExcludeFromAll.cmake @@ -0,0 +1,11 @@ +enable_language(C) + +include(FetchContent) + +FetchContent_Declare( + ExcludeFromAll + SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/ExcludeFromAll + EXCLUDE_FROM_ALL +) + +FetchContent_MakeAvailable(ExcludeFromAll) diff --git a/Tests/RunCMake/FetchContent/ExcludeFromAll/CMakeLists.txt b/Tests/RunCMake/FetchContent/ExcludeFromAll/CMakeLists.txt new file mode 100644 index 0000000..08ffb33 --- /dev/null +++ b/Tests/RunCMake/FetchContent/ExcludeFromAll/CMakeLists.txt @@ -0,0 +1 @@ +add_library(broken STATIC error.c) diff --git a/Tests/RunCMake/FetchContent/ExcludeFromAll/error.c b/Tests/RunCMake/FetchContent/ExcludeFromAll/error.c new file mode 100644 index 0000000..f10e687 --- /dev/null +++ b/Tests/RunCMake/FetchContent/ExcludeFromAll/error.c @@ -0,0 +1 @@ +#error "This should not be compiled" diff --git a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake index 3781089..d0790eb 100644 --- a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake +++ b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake @@ -64,3 +64,15 @@ run_cmake_command(ScriptMode -DCMAKE_MAKE_PROGRAM=${RunCMake_MAKE_PROGRAM} -P ${CMAKE_CURRENT_LIST_DIR}/ScriptMode.cmake ) + +function(run_FetchContent_ExcludeFromAll) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/ExcludeFromAll-build) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(ExcludeFromAll) + + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(ExcludeFromAll-build ${CMAKE_COMMAND} --build .) +endfunction() +run_FetchContent_ExcludeFromAll() diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/fileset.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/fileset.json index c4df2ec..f260037 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/fileset.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/fileset.json @@ -16,7 +16,7 @@ "type": "target", "destination": "lib", "paths": [ - "^fileset/((Debug|Release|MinSizeRel|RelWithDebInfo)/)?(lib)?c_headers_1\\.(a|lib)?$" + "^fileset/((Debug|Release|MinSizeRel|RelWithDebInfo)/)?(lib)?c_headers_1\\.(a|lib|l)?$" ], "isExcludeFromAll": null, "isForAllComponents": null, @@ -172,7 +172,7 @@ "type": "target", "destination": "lib", "paths": [ - "^fileset/((Debug|Release|MinSizeRel|RelWithDebInfo)/)?(lib)?c_headers_2\\.(a|lib)?$" + "^fileset/((Debug|Release|MinSizeRel|RelWithDebInfo)/)?(lib)?c_headers_2\\.(a|lib|l)?$" ], "isExcludeFromAll": null, "isForAllComponents": null, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json index a35d5e2..b57ab45 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json @@ -80,7 +80,7 @@ "type": "target", "destination": "lib", "paths": [ - "^((Debug|Release|MinSizeRel|RelWithDebInfo)/)?(lib)?c_shared_lib\\.(lib|dll\\.a)$" + "^((Debug|Release|MinSizeRel|RelWithDebInfo)/)?(lib)?c_shared_lib\\.(dll\\.a|lib|l)$" ], "isExcludeFromAll": null, "isForAllComponents": null, @@ -173,7 +173,7 @@ "type": "target", "destination": "lib", "paths": [ - "^cxx/((Debug|Release|MinSizeRel|RelWithDebInfo)/)?(lib)?cxx_shared_lib\\.(lib|dll\\.a)$" + "^cxx/((Debug|Release|MinSizeRel|RelWithDebInfo)/)?(lib)?cxx_shared_lib\\.(dll\\.a|lib|l)$" ], "isExcludeFromAll": null, "isForAllComponents": null, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_1.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_1.json index f6cfa9c..faf0eaa 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_1.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_1.json @@ -219,10 +219,10 @@ } ], "folder": null, - "nameOnDisk": "^(lib)?c_headers_1\\.(a|lib)$", + "nameOnDisk": "^(lib)?c_headers_1\\.(a|lib|l)$", "artifacts": [ { - "path": "^fileset/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?c_headers_1\\.(a|lib)$", + "path": "^fileset/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?c_headers_1\\.(a|lib|l)$", "_dllExtra": false } ], diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_2.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_2.json index 591ba4f..b4f2f9d 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_2.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_2.json @@ -71,10 +71,10 @@ } ], "folder": null, - "nameOnDisk": "^(lib)?c_headers_2\\.(a|lib)$", + "nameOnDisk": "^(lib)?c_headers_2\\.(a|lib|l)$", "artifacts": [ { - "path": "^fileset/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?c_headers_2\\.(a|lib)$", + "path": "^fileset/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?c_headers_2\\.(a|lib|l)$", "_dllExtra": false } ], diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_lib.json index dc74fdf..5b58dd1 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_lib.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_lib.json @@ -88,10 +88,10 @@ } ], "folder": null, - "nameOnDisk": "^(lib)?c_lib\\.(a|lib)$", + "nameOnDisk": "^(lib)?c_lib\\.(a|lib|l)$", "artifacts": [ { - "path": "^((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?c_lib\\.(a|lib)$", + "path": "^((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?c_lib\\.(a|lib|l)$", "_dllExtra": false } ], diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json index 85b5108..8d5faf8 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json @@ -100,7 +100,7 @@ "_dllExtra": false }, { - "path": "^((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?c_shared_lib\\.(dll\\.a|lib)$", + "path": "^((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?c_shared_lib\\.(dll\\.a|lib|l)$", "_dllExtra": true }, { diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_lib.json index 6a51295..2220581 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_lib.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_lib.json @@ -88,10 +88,10 @@ } ], "folder": null, - "nameOnDisk": "^(lib)?c_static_lib\\.(a|lib)$", + "nameOnDisk": "^(lib)?c_static_lib\\.(a|lib|l)$", "artifacts": [ { - "path": "^((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?c_static_lib\\.(a|lib)$", + "path": "^((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?c_static_lib\\.(a|lib|l)$", "_dllExtra": false } ], diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_subdir.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_subdir.json index 362caf9..a5bebcd 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_subdir.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_subdir.json @@ -113,10 +113,10 @@ } ], "folder": null, - "nameOnDisk": "^(lib)?c_subdir\\.(a|lib)$", + "nameOnDisk": "^(lib)?c_subdir\\.(a|lib|l)$", "artifacts": [ { - "path": "^((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?c_subdir\\.(a|lib)$", + "path": "^((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?c_subdir\\.(a|lib|l)$", "_dllExtra": false } ], diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_lib.json index 725cad9..2f8d6ed 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_lib.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_lib.json @@ -64,10 +64,10 @@ } ], "folder": null, - "nameOnDisk": "^(lib)?cxx_lib\\.(a|lib)$", + "nameOnDisk": "^(lib)?cxx_lib\\.(a|lib|l)$", "artifacts": [ { - "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?cxx_lib\\.(a|lib)$", + "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?cxx_lib\\.(a|lib|l)$", "_dllExtra": false } ], diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json index c92e573..2274e45 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json @@ -76,7 +76,7 @@ "_dllExtra": false }, { - "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?cxx_shared_lib\\.(dll\\.a|lib)$", + "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?cxx_shared_lib\\.(dll\\.a|lib|l)$", "_dllExtra": true }, { diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_static_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_static_lib.json index 38790dd..2f322b0 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_static_lib.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_static_lib.json @@ -64,10 +64,10 @@ } ], "folder": null, - "nameOnDisk": "^(lib)?cxx_static_lib\\.(a|lib)$", + "nameOnDisk": "^(lib)?cxx_static_lib\\.(a|lib|l)$", "artifacts": [ { - "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?cxx_static_lib\\.(a|lib)$", + "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?cxx_static_lib\\.(a|lib|l)$", "_dllExtra": false } ], diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/interface_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/interface_exe.json index 93df8a6..5b47814 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/interface_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/interface_exe.json @@ -170,7 +170,7 @@ "_dllExtra": false }, { - "path": "^lib/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?my_interface_exe\\.(dll\\.a|lib)$", + "path": "^lib/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?my_interface_exe\\.(dll\\.a|lib|l)$", "_dllExtra": true }, { diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/shared_framework.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/shared_framework.json index 41b5605..fab6f66 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/shared_framework.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/shared_framework.json @@ -76,7 +76,7 @@ "_dllExtra": false }, { - "path": "^framework/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?shared_framework\\.(dll\\.a|lib)$", + "path": "^framework/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?shared_framework\\.(dll\\.a|lib|l)$", "_dllExtra": true }, { diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/static_framework.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/static_framework.json index 00dd11e..d6cbded 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/static_framework.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/static_framework.json @@ -64,10 +64,10 @@ } ], "folder": null, - "nameOnDisk": "^(lib)?static_framework\\.(a|lib)$", + "nameOnDisk": "^(lib)?static_framework\\.(a|lib|l)$", "artifacts": [ { - "path": "^framework/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?static_framework\\.(a|lib)$", + "path": "^framework/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib)?static_framework\\.(a|lib|l)$", "_dllExtra": false } ], diff --git a/Tests/RunCMake/GenerateExportHeader/GEH.cmake b/Tests/RunCMake/GenerateExportHeader/GEH.cmake index 3e35aa3..a34708e 100644 --- a/Tests/RunCMake/GenerateExportHeader/GEH.cmake +++ b/Tests/RunCMake/GenerateExportHeader/GEH.cmake @@ -98,7 +98,7 @@ if (WIN32 OR CYGWIN) if((CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM") AND CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC") set(_platform Win32-Clang) - elseif(MSVC AND COMPILER_HAS_DEPRECATED) + elseif((MSVC OR CMAKE_C_COMPILER_ID STREQUAL "OrangeC") AND COMPILER_HAS_DEPRECATED) set(_platform Win32) elseif(CYGWIN AND COMPILER_HAS_DEPRECATED) set(_platform Cygwin) diff --git a/Tests/RunCMake/GeneratorExpressionShortCircuit/BadAND-result.txt b/Tests/RunCMake/GeneratorExpressionShortCircuit/BadAND-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpressionShortCircuit/BadAND-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpressionShortCircuit/BadAND-stderr.txt b/Tests/RunCMake/GeneratorExpressionShortCircuit/BadAND-stderr.txt new file mode 100644 index 0000000..1267cb3 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpressionShortCircuit/BadAND-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at BadAND.cmake:2 \(add_custom_target\): + Error evaluating generator expression: + + \$<0> + + \$<0> expression requires a parameter. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpressionShortCircuit/BadAND.cmake b/Tests/RunCMake/GeneratorExpressionShortCircuit/BadAND.cmake new file mode 100644 index 0000000..91efaf4 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpressionShortCircuit/BadAND.cmake @@ -0,0 +1,4 @@ +set(error $<0>) +add_custom_target(check ALL COMMAND check + $<AND:1,${error}> +) diff --git a/Tests/RunCMake/GeneratorExpressionShortCircuit/BadIF-result.txt b/Tests/RunCMake/GeneratorExpressionShortCircuit/BadIF-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpressionShortCircuit/BadIF-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpressionShortCircuit/BadIF-stderr.txt b/Tests/RunCMake/GeneratorExpressionShortCircuit/BadIF-stderr.txt new file mode 100644 index 0000000..4e296a5 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpressionShortCircuit/BadIF-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at BadIF.cmake:2 \(add_custom_target\): + Error evaluating generator expression: + + \$<0> + + \$<0> expression requires a parameter. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpressionShortCircuit/BadIF.cmake b/Tests/RunCMake/GeneratorExpressionShortCircuit/BadIF.cmake new file mode 100644 index 0000000..797cc69 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpressionShortCircuit/BadIF.cmake @@ -0,0 +1,4 @@ +set(error $<0>) +add_custom_target(check ALL COMMAND check + $<IF:0,1,${error}> +) diff --git a/Tests/RunCMake/GeneratorExpressionShortCircuit/BadOR-result.txt b/Tests/RunCMake/GeneratorExpressionShortCircuit/BadOR-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpressionShortCircuit/BadOR-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpressionShortCircuit/BadOR-stderr.txt b/Tests/RunCMake/GeneratorExpressionShortCircuit/BadOR-stderr.txt new file mode 100644 index 0000000..7876d7d --- /dev/null +++ b/Tests/RunCMake/GeneratorExpressionShortCircuit/BadOR-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at BadOR.cmake:2 \(add_custom_target\): + Error evaluating generator expression: + + \$<0> + + \$<0> expression requires a parameter. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpressionShortCircuit/BadOR.cmake b/Tests/RunCMake/GeneratorExpressionShortCircuit/BadOR.cmake new file mode 100644 index 0000000..7477b8f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpressionShortCircuit/BadOR.cmake @@ -0,0 +1,4 @@ +set(error $<0>) +add_custom_target(check ALL COMMAND check + $<OR:0,${error}> +) diff --git a/Tests/RunCMake/GeneratorExpressionShortCircuit/CMakeLists.txt b/Tests/RunCMake/GeneratorExpressionShortCircuit/CMakeLists.txt new file mode 100644 index 0000000..54a4d62 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpressionShortCircuit/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.26) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/GeneratorExpressionShortCircuit/GoodAND.cmake b/Tests/RunCMake/GeneratorExpressionShortCircuit/GoodAND.cmake new file mode 100644 index 0000000..26bcaba --- /dev/null +++ b/Tests/RunCMake/GeneratorExpressionShortCircuit/GoodAND.cmake @@ -0,0 +1,4 @@ +set(error $<0>) +add_custom_target(check ALL COMMAND check + $<AND:0,${error}> +) diff --git a/Tests/RunCMake/GeneratorExpressionShortCircuit/GoodIF.cmake b/Tests/RunCMake/GeneratorExpressionShortCircuit/GoodIF.cmake new file mode 100644 index 0000000..1f9fbe6 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpressionShortCircuit/GoodIF.cmake @@ -0,0 +1,5 @@ +set(error $<0>) +add_custom_target(check ALL + COMMAND check $<IF:1,1,${error}> + COMMAND Check $<IF:0,${error},1> +) diff --git a/Tests/RunCMake/GeneratorExpressionShortCircuit/GoodOR.cmake b/Tests/RunCMake/GeneratorExpressionShortCircuit/GoodOR.cmake new file mode 100644 index 0000000..b574937 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpressionShortCircuit/GoodOR.cmake @@ -0,0 +1,4 @@ +set(error $<0>) +add_custom_target(check ALL COMMAND check + $<OR:1,${error}> +) diff --git a/Tests/RunCMake/GeneratorExpressionShortCircuit/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpressionShortCircuit/RunCMakeTest.cmake new file mode 100644 index 0000000..b0ad679 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpressionShortCircuit/RunCMakeTest.cmake @@ -0,0 +1,9 @@ +include(RunCMake) + +run_cmake(GoodIF) +run_cmake(GoodAND) +run_cmake(GoodOR) + +run_cmake(BadIF) +run_cmake(BadAND) +run_cmake(BadOR) diff --git a/Tests/RunCMake/GoogleTest/xcode_sign_adhoc.cmake b/Tests/RunCMake/GoogleTest/xcode_sign_adhoc.cmake index d2dc530..571e4aa 100644 --- a/Tests/RunCMake/GoogleTest/xcode_sign_adhoc.cmake +++ b/Tests/RunCMake/GoogleTest/xcode_sign_adhoc.cmake @@ -1,8 +1,14 @@ function(xcode_sign_adhoc target) if(CMAKE_GENERATOR STREQUAL "Xcode" AND - "${CMAKE_SYSTEM_NAME};${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "Darwin;arm64") - # Xcode runs POST_BUILD before signing, so let the linker use ad-hoc signing. - # See CMake Issue 21845. - target_link_options(${target} PRIVATE LINKER:-adhoc_codesign) + "${CMAKE_SYSTEM_NAME};${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "Darwin;arm64") + if(XCODE_VERSION VERSION_GREATER_EQUAL 15) + # Xcode 15+ enforces '-Xlinker -no_adhoc_codesign' after user flags, + # so we cannot convince the linker to add an adhoc signature. + add_custom_command(TARGET ${target} POST_BUILD COMMAND codesign --sign - --force "$<TARGET_FILE:${target}>") + else() + # Xcode runs POST_BUILD before signing, so let the linker use ad-hoc signing. + # See CMake Issue 21845. + target_link_options(${target} PRIVATE LINKER:-adhoc_codesign) + endif() endif() endfunction() diff --git a/Tests/RunCMake/MultiLint/RunCMakeTest.cmake b/Tests/RunCMake/MultiLint/RunCMakeTest.cmake index 9b7a6a9..f2df290 100644 --- a/Tests/RunCMake/MultiLint/RunCMakeTest.cmake +++ b/Tests/RunCMake/MultiLint/RunCMakeTest.cmake @@ -24,6 +24,7 @@ run_multilint(CXX) if(NOT RunCMake_GENERATOR STREQUAL "Watcom WMake") run_multilint(C-launch) run_multilint(CXX-launch) + run_multilint(genex) endif() function(run_skip_linting test_name) diff --git a/Tests/RunCMake/MultiLint/genex.cmake b/Tests/RunCMake/MultiLint/genex.cmake new file mode 100644 index 0000000..17f9248 --- /dev/null +++ b/Tests/RunCMake/MultiLint/genex.cmake @@ -0,0 +1,6 @@ +enable_language(CXX) +set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE "$<IF:$<BOOL:FALSE>,${PSEUDO_IWYU},>") +set(CMAKE_CXX_CLANG_TIDY "$<IF:$<BOOL:FALSE>,${PSEUDO_TIDY} --error,>") +set(CMAKE_CXX_CPPLINT "$<IF:$<BOOL:FALSE>,${PSEUDO_CPPLINT} --error,>") +set(CMAKE_CXX_CPPCHECK "$<IF:$<BOOL:FALSE>,${PSEUDO_CPPCHECK} -bad,>") +add_executable(main main.cxx) diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake index 6cc6234..69f2587 100644 --- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake +++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake @@ -348,7 +348,11 @@ if("${ninja_version}" VERSION_LESS 1.6) return() endif() -foreach(ninja_output_path_prefix "sub space" "sub") +set(ninja_output_path_prefixes "sub") +if(NOT CMAKE_C_COMPILER_ID STREQUAL "OrangeC") + list(APPEND ninja_output_path_prefixes "sub space") +endif() +foreach(ninja_output_path_prefix IN LISTS ninja_output_path_prefixes) run_sub_cmake(Executable "${ninja_output_path_prefix}") run_sub_cmake(StaticLib "${ninja_output_path_prefix}") run_sub_cmake(SharedLib "${ninja_output_path_prefix}") diff --git a/Tests/RunCMake/NinjaMultiConfig/CompileCommands-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CompileCommands-check.cmake index 30b24bf..e65be3b 100644 --- a/Tests/RunCMake/NinjaMultiConfig/CompileCommands-check.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/CompileCommands-check.cmake @@ -8,7 +8,7 @@ set(expected_compile_commands ]*", "file": "[^ ]*(/Tests/RunCMake/NinjaMultiConfig/main\.c|\\\\Tests\\\\RunCMake\\\\NinjaMultiConfig\\\\main\.c)", - "output": "(CMakeFiles/exe\.dir/Debug/main\.c\.o|CMakeFiles\\\\exe\.dir\\\\Debug\\\\main\.c\.obj)" + "output": "(CMakeFiles/exe\.dir/Debug/main\.c\.o|CMakeFiles\\\\exe\.dir\\\\Debug\\\\main\.c\.(obj|o))" }, { "directory": "[^ @@ -18,7 +18,7 @@ set(expected_compile_commands ]*", "file": "[^ ]*(/Tests/RunCMake/NinjaMultiConfig/main\.c|\\\\Tests\\\\RunCMake\\\\NinjaMultiConfig\\\\main\.c)", - "output": "(CMakeFiles/exe\.dir/Release/main\.c\.o|CMakeFiles\\\\exe\.dir\\\\Release\\\\main\.c\.obj)" + "output": "(CMakeFiles/exe\.dir/Release/main\.c\.o|CMakeFiles\\\\exe\.dir\\\\Release\\\\main\.c\.(obj|o))" } ]$]==]) diff --git a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake index 7128aaf..a39606d 100644 --- a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake @@ -17,7 +17,7 @@ function(check_files dir) list(SORT expected) file(GLOB_RECURSE actual "${dir}/*") - list(FILTER actual EXCLUDE REGEX "/CMakeFiles/|\\.ninja$|/CMakeCache\\.txt$|/target_files[^/]*\\.cmake$|/\\.ninja_[^/]*$|/cmake_install\\.cmake$|\\.ilk$|\\.manifest$|\\.pdb$|\\.exp$|/install_manifest\\.txt$|/\\.qt/QtDeploySupport[^/]*\\.cmake$") + list(FILTER actual EXCLUDE REGEX "/CMakeFiles/|\\.ninja$|/CMakeCache\\.txt$|/target_files[^/]*\\.cmake$|/\\.ninja_[^/]*$|/cmake_install\\.cmake$|\\.ilk$|\\.manifest$|\\.odx$|\\.pdb$|\\.exp$|/install_manifest\\.txt$|/\\.qt/QtDeploySupport[^/]*\\.cmake$") foreach(f IN LISTS _check_files_INCLUDE _check_files_EXCLUDE) if(EXISTS ${f}) list(APPEND actual ${f}) diff --git a/Tests/RunCMake/NinjaMultiConfig/SimpleNoCross-all-target-ninja-stderr.txt b/Tests/RunCMake/NinjaMultiConfig/SimpleNoCross-all-target-ninja-stderr.txt index 6db4bcc..ace6512 100644 --- a/Tests/RunCMake/NinjaMultiConfig/SimpleNoCross-all-target-ninja-stderr.txt +++ b/Tests/RunCMake/NinjaMultiConfig/SimpleNoCross-all-target-ninja-stderr.txt @@ -1 +1 @@ -^ninja: error: unknown target 'simplestatic:all'$ +^ninja: error: unknown target 'simplestatic:all'(, did you mean 'simplestatic.l'\?)?$ diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjLHSShared.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjLHSShared.cmake index 3d60556..a1fa7b3 100644 --- a/Tests/RunCMake/ObjectLibrary/LinkObjLHSShared.cmake +++ b/Tests/RunCMake/ObjectLibrary/LinkObjLHSShared.cmake @@ -14,8 +14,14 @@ target_link_libraries(LinkObjLHSShared AnObjLib) # Verify that our dependency on OtherLib generated its versioning symlinks. if(CMAKE_GENERATOR STREQUAL "Xcode" AND "${CMAKE_SYSTEM_NAME};${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "Darwin;arm64") - # Xcode runs POST_BUILD before signing, so let the linker use ad-hoc signing. - # See CMake Issue 21845. - target_link_options(LinkObjLHSShared PRIVATE LINKER:-adhoc_codesign) + if(XCODE_VERSION VERSION_GREATER_EQUAL 15) + # Xcode 15+ enforces '-Xlinker -no_adhoc_codesign' after user flags, + # so we cannot convince the linker to add an adhoc signature. + add_custom_command(TARGET LinkObjLHSShared POST_BUILD COMMAND codesign --sign - --force "$<TARGET_FILE:LinkObjLHSShared>") + else() + # Xcode runs POST_BUILD before signing, so let the linker use ad-hoc signing. + # See CMake Issue 21845. + target_link_options(LinkObjLHSShared PRIVATE LINKER:-adhoc_codesign) + endif() endif() add_custom_command(TARGET LinkObjLHSShared POST_BUILD COMMAND LinkObjLHSShared) diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index 8939cb7..fcf904e 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -201,6 +201,8 @@ function(run_cmake test) "|ic(p?c|l): remark #10441: The Intel\\(R\\) C\\+\\+ Compiler Classic \\(ICC\\) is deprecated" "|[^\n]*install_name_tool: warning: changes being made to the file will invalidate the code signature in:" + "|[^\n]*(createItemModels|_NSMainThread|Please file a bug at)" + "|[^\n]*xcodebuild[^\n]*DVTAssertions: Warning" "|[^\n]*xcodebuild[^\n]*DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default" "|[^\n]*xcodebuild[^\n]*DVTPlugInManager" "|[^\n]*xcodebuild[^\n]*DVTSDK: Warning: SDK path collision for path" diff --git a/Tests/RunCMake/XcFramework/RunCMakeTest.cmake b/Tests/RunCMake/XcFramework/RunCMakeTest.cmake index 22c28b4..9a13892 100644 --- a/Tests/RunCMake/XcFramework/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcFramework/RunCMakeTest.cmake @@ -14,25 +14,36 @@ function(create_libraries type) create_library(${type} ios iOS "arm64" iphoneos) create_library(${type} tvos tvOS "arm64" appletvos) create_library(${type} watchos watchOS "armv7k\\\\;arm64_32" watchos) - if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 15) - create_library(${type} visionos visionOS "arm64" xros) - endif() + #FIXME(#25266): Xcode 15.0 does not have visionOS. Improve this condition. + #if(CMake_TEST_XCODE_VERSION VERSION_GREATER_EQUAL 15) + # create_library(${type} visionos visionOS "arm64" xros) + #endif() create_library(${type} ios-simulator iOS "${macos_archs_2}" iphonesimulator) create_library(${type} tvos-simulator tvOS "${macos_archs_2}" appletvsimulator) create_library(${type} watchos-simulator watchOS "${watch_sim_archs_2}" watchsimulator) - if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 15) - create_library(${type} visionos-simulator visionOS "${macos_archs_2}" xrsimulator) - endif() + #FIXME(#25266): Xcode 15.0 does not have visionOS. Improve this condition. + #if(CMake_TEST_XCODE_VERSION VERSION_GREATER_EQUAL 15) + # create_library(${type} visionos-simulator visionOS "${macos_archs_2}" xrsimulator) + #endif() endfunction() function(create_xcframework name type platforms) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/create-xcframework-${name}-build) + if(CMake_TEST_XCODE_VERSION VERSION_GREATER_EQUAL 15) + # 'xcodebuild -create-xcframework' fails on symlinked paths. + file(REAL_PATH "${RunCMake_SOURCE_DIR}" src_dir) + file(REAL_PATH "${RunCMake_BINARY_DIR}" bld_dir) + else() + set(src_dir "${RunCMake_SOURCE_DIR}") + set(bld_dir "${RunCMake_BINARY_DIR}") + endif() set(args) foreach(platform IN LISTS platforms) + set(lib_dir "${bld_dir}/create-${type}-${platform}-build/install/lib") if(type STREQUAL "framework") - list(APPEND args -framework ${RunCMake_BINARY_DIR}/create-${type}-${platform}-build/install/lib/mylib.framework) + list(APPEND args -framework ${lib_dir}/mylib.framework) else() - list(APPEND args -library ${RunCMake_BINARY_DIR}/create-${type}-${platform}-build/install/lib/libmylib.a -headers ${RunCMake_SOURCE_DIR}/mylib/include) + list(APPEND args -library ${lib_dir}/libmylib.a -headers ${src_dir}/mylib/include) endif() endforeach() run_cmake_command(create-xcframework-${name} xcodebuild -create-xcframework ${args} -output ${RunCMake_TEST_BINARY_DIR}/mylib.xcframework) @@ -51,22 +62,25 @@ function(create_executables name type) create_executable(${name}-ios ${type} iOS "arm64" iphoneos) create_executable(${name}-tvos ${type} tvOS "arm64" appletvos) create_executable(${name}-watchos ${type} watchOS "armv7k\\\\;arm64_32" watchos) - if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 15) - create_executable(${name}-visionos ${type} visionOS "arm64" xros) - endif() + #FIXME(#25266): Xcode 15.0 does not have visionOS. Improve this condition. + #if(CMake_TEST_XCODE_VERSION VERSION_GREATER_EQUAL 15) + # create_executable(${name}-visionos ${type} visionOS "arm64" xros) + #endif() create_executable(${name}-ios-simulator ${type} iOS "${macos_archs_2}" iphonesimulator) create_executable(${name}-tvos-simulator ${type} tvOS "${macos_archs_2}" appletvsimulator) create_executable(${name}-watchos-simulator ${type} watchOS "${watch_sim_archs_2}" watchsimulator) - if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 15) - create_executable(${name}-visionos-simulator ${type} visionOS "${macos_archs_2}" xrsimulator) - endif() + #FIXME(#25266): Xcode 15.0 does not have visionOS. Improve this condition. + #if(CMake_TEST_XCODE_VERSION VERSION_GREATER_EQUAL 15) + # create_executable(${name}-visionos-simulator ${type} visionOS "${macos_archs_2}" xrsimulator) + #endif() endfunction() set(xcframework_platforms macos ios tvos watchos ios-simulator tvos-simulator watchos-simulator) -if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 15) - list(APPEND xcframework_platforms visionos visionos-simulator) -endif() -if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 12) +#FIXME(#25266): Xcode 15.0 does not have visionOS. Improve this condition. +#if(CMake_TEST_XCODE_VERSION VERSION_GREATER_EQUAL 15) +# list(APPEND xcframework_platforms visionos visionos-simulator) +#endif() +if(CMake_TEST_XCODE_VERSION VERSION_GREATER_EQUAL 12) set(macos_archs_1 "x86_64\\;arm64") set(macos_archs_2 "x86_64\\\\;arm64") set(watch_sim_archs_2 "x86_64") @@ -87,7 +101,7 @@ run_cmake_with_options(create-executable-incomplete -DCMAKE_SYSTEM_NAME=Darwin " create_executables(target-library library) create_executables(target-framework framework) run_cmake_with_options(create-executable-target-incomplete -DCMAKE_SYSTEM_NAME=Darwin "-DCMAKE_OSX_ARCHITECTURES=${macos_archs_1}" -DMYLIB_LIBRARY=${RunCMake_BINARY_DIR}/create-xcframework-incomplete-build/mylib.xcframework) -if(RunCMake_GENERATOR STREQUAL "Xcode" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 12) +if(RunCMake_GENERATOR STREQUAL "Xcode" AND CMake_TEST_XCODE_VERSION VERSION_GREATER_EQUAL 12) create_executables(library-link-phase library) create_executables(framework-link-phase framework) run_cmake_with_options(create-executable-incomplete-link-phase -DCMAKE_SYSTEM_NAME=Darwin "-DCMAKE_OSX_ARCHITECTURES=${macos_archs_1}" -DMYLIB_LIBRARY=${RunCMake_BINARY_DIR}/create-xcframework-incomplete-build/mylib.xcframework) diff --git a/Tests/RunCMake/XcodeProject-Device/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject-Device/RunCMakeTest.cmake index abb357b..e4dbb90 100644 --- a/Tests/RunCMake/XcodeProject-Device/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject-Device/RunCMakeTest.cmake @@ -93,24 +93,25 @@ if(NOT XCODE_VERSION VERSION_LESS 7.1) unset(RunCMake_TEST_OPTIONS) endif() -if(NOT XCODE_VERSION VERSION_LESS 15) - set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeBundlesVisionOS-build) - set(RunCMake_TEST_NO_CLEAN 1) - set(RunCMake_TEST_OPTIONS - "-DCMAKE_SYSTEM_NAME=visionOS" - "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install") - - file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") - file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") - - run_cmake(XcodeBundles) - run_cmake_command(XcodeBundles-build-visionOS ${CMAKE_COMMAND} --build .) - run_cmake_command(XcodeBundles-install-visionOS ${CMAKE_COMMAND} --build . --target install) - - unset(RunCMake_TEST_BINARY_DIR) - unset(RunCMake_TEST_NO_CLEAN) - unset(RunCMake_TEST_OPTIONS) -endif() +#FIXME(#25266): Xcode 15.0 does not have visionOS. Improve this condition. +#if(NOT XCODE_VERSION VERSION_LESS 15) +# set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeBundlesVisionOS-build) +# set(RunCMake_TEST_NO_CLEAN 1) +# set(RunCMake_TEST_OPTIONS +# "-DCMAKE_SYSTEM_NAME=visionOS" +# "-DCMAKE_INSTALL_PREFIX:PATH=${RunCMake_TEST_BINARY_DIR}/_install") +# +# file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") +# file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") +# +# run_cmake(XcodeBundles) +# run_cmake_command(XcodeBundles-build-visionOS ${CMAKE_COMMAND} --build .) +# run_cmake_command(XcodeBundles-install-visionOS ${CMAKE_COMMAND} --build . --target install) +# +# unset(RunCMake_TEST_BINARY_DIR) +# unset(RunCMake_TEST_NO_CLEAN) +# unset(RunCMake_TEST_OPTIONS) +#endif() if(NOT XCODE_VERSION VERSION_LESS 7) set(RunCMake_TEST_OPTIONS "-DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/osx.cmake") @@ -261,10 +262,11 @@ if(XCODE_VERSION VERSION_GREATER_EQUAL 8) deployment_target_test(tvOS appletvsimulator) deployment_target_test(watchOS watchos) deployment_target_test(watchOS watchsimulator) - if(XCODE_VERSION VERSION_GREATER_EQUAL 15) - deployment_target_test(visionOS xros) - deployment_target_test(visionOS xrsimulator) - endif() + #FIXME(#25266): Xcode 15.0 does not have visionOS. Improve this condition. + #if(XCODE_VERSION VERSION_GREATER_EQUAL 15) + # deployment_target_test(visionOS xros) + # deployment_target_test(visionOS xrsimulator) + #endif() endif() if(XCODE_VERSION VERSION_GREATER_EQUAL 8) diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/windows-all-check.cmake b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/windows-all-check.cmake index 10b7b82..61ab542 100644 --- a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/windows-all-check.cmake +++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/windows-all-check.cmake @@ -1,4 +1,4 @@ -if(CMAKE_C_COMPILER_ID STREQUAL "Borland") +if(CMAKE_C_COMPILER_ID MATCHES "^(Borland|OrangeC)$") # Borland upper-cases dll names referenced in import libraries. set(conflict_dll [[CONFLICT\.DLL]]) set(unresolved_dll [[UNRESOLVED\.DLL]]) diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/windows-conflict-all-stderr-OrangeC.txt b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/windows-conflict-all-stderr-OrangeC.txt new file mode 100644 index 0000000..607e4b8 --- /dev/null +++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/windows-conflict-all-stderr-OrangeC.txt @@ -0,0 +1,7 @@ +^CMake Error at cmake_install\.cmake:[0-9]+ \(file\): + file Multiple conflicting paths found for PATH\.DLL: + + [^ +]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/windows-conflict-build/root-all/lib/test1/path\.dll + [^ +]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/windows-conflict-build/root-all/lib/test2/path\.dll$ diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/windows-unresolved-all-stderr-OrangeC.txt b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/windows-unresolved-all-stderr-OrangeC.txt new file mode 100644 index 0000000..fea1083 --- /dev/null +++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/windows-unresolved-all-stderr-OrangeC.txt @@ -0,0 +1,4 @@ +^CMake Error at cmake_install\.cmake:[0-9]+ \(file\): + file Could not resolve runtime dependencies: + + UNRESOLVED\.DLL$ diff --git a/Tests/RunCMake/install/TARGETS-Defaults-Cache-all-check.cmake b/Tests/RunCMake/install/TARGETS-Defaults-Cache-all-check.cmake index d099469..97b9b5d 100644 --- a/Tests/RunCMake/install/TARGETS-Defaults-Cache-all-check.cmake +++ b/Tests/RunCMake/install/TARGETS-Defaults-Cache-all-check.cmake @@ -1,7 +1,7 @@ if(WIN32) set(_check_files [[lib3]] - [[lib3/(lib)?lib3\.(dll\.a|lib)]] + [[lib3/(lib)?lib3\.(dll\.a|lib|l)]] [[lib4]] [[lib4/(lib)?lib4\.dll]] [[mybin]] @@ -10,8 +10,8 @@ if(WIN32) [[myinclude]] [[myinclude/obj3\.h]] [[mylib]] - [[mylib/(lib)?lib1\.(dll\.a|lib)]] - [[mylib/(lib)?lib2\.(a|lib)]] + [[mylib/(lib)?lib1\.(dll\.a|lib|l)]] + [[mylib/(lib)?lib2\.(a|lib|l)]] ) elseif(MSYS) set(_check_files diff --git a/Tests/RunCMake/install/TARGETS-Defaults-all-check.cmake b/Tests/RunCMake/install/TARGETS-Defaults-all-check.cmake index 6e13b84..f357c1e 100644 --- a/Tests/RunCMake/install/TARGETS-Defaults-all-check.cmake +++ b/Tests/RunCMake/install/TARGETS-Defaults-all-check.cmake @@ -8,10 +8,10 @@ if(WIN32) [[include/obj2\.h]] [[include/obj3\.h]] [[lib]] - [[lib/(lib)?lib1\.(dll\.a|lib)]] - [[lib/(lib)?lib2\.(a|lib)]] + [[lib/(lib)?lib1\.(dll\.a|lib|l)]] + [[lib/(lib)?lib2\.(a|lib|l)]] [[lib3]] - [[lib3/(lib)?lib3\.(dll\.a|lib)]] + [[lib3/(lib)?lib3\.(dll\.a|lib|l)]] [[lib4]] [[lib4/(lib)?lib4\.dll]] ) diff --git a/Tests/RunCMake/install/TARGETS-OUTPUT_NAME-all-check.cmake b/Tests/RunCMake/install/TARGETS-OUTPUT_NAME-all-check.cmake index 91d5ef0..919ccf1 100644 --- a/Tests/RunCMake/install/TARGETS-OUTPUT_NAME-all-check.cmake +++ b/Tests/RunCMake/install/TARGETS-OUTPUT_NAME-all-check.cmake @@ -1,7 +1,7 @@ if(WIN32) set(test123 [[bin/test1out\.exe;bin/test2deb\.exe;bin/test3exc\.exe]]) set(libtest45 [[bin/libtest4\.dll;bin/libtest4\.dll\.a;bin/libtest5ar\.a]]) - set(test45 [[bin/test4\.dll;bin/test4\.lib;bin/test5ar\.lib]]) + set(test45 [[bin/test4\.dll;bin/test4\.(lib|l);bin/test5ar\.(lib|l)]]) check_installed("^bin;(${libtest45};${test123})|(${test123};${test45})\$") elseif(MSYS) diff --git a/Tests/RunCMake/install/TARGETS-Parts-all-check.cmake b/Tests/RunCMake/install/TARGETS-Parts-all-check.cmake index 6245839..8137e92 100644 --- a/Tests/RunCMake/install/TARGETS-Parts-all-check.cmake +++ b/Tests/RunCMake/install/TARGETS-Parts-all-check.cmake @@ -1 +1 @@ -check_installed([[^include;include/obj1\.h;lib;lib/(mylib\.lib|(lib|cyg)mylib\.a)$]]) +check_installed([[^include;include/obj1\.h;lib;lib/(mylib\.(lib|l)|(lib|cyg)mylib\.a)$]]) diff --git a/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-empty-all-check.cmake b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-empty-all-check.cmake index dafc2a4..38635c3 100644 --- a/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-empty-all-check.cmake +++ b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-empty-all-check.cmake @@ -1 +1 @@ -check_installed([[^static;static/(liblib\.a|lib\.lib)$]]) +check_installed([[^static;static/(liblib\.a|lib\.(lib|l))$]]) diff --git a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/RunCMakeTest.cmake b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/RunCMakeTest.cmake index 8e4745a..0f3a6b7 100644 --- a/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_link_libraries-LINK_LIBRARY/RunCMakeTest.cmake @@ -31,7 +31,7 @@ if ((RunCMake_GENERATOR MATCHES "Makefiles|Ninja|Xcode" set(LINK_SHARED_LIBRARY_PREFIX ${CMAKE_SHARED_LIBRARY_PREFIX}) set(LINK_SHARED_LIBRARY_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX}) endif() - if (MINGW OR MSYS OR CYGWIN) + if (MINGW OR MSYS OR CYGWIN OR CMAKE_C_COMPILER_ID STREQUAL "OrangeC") set(LINK_EXTERN_LIBRARY_SUFFIX "") else() set(LINK_EXTERN_LIBRARY_SUFFIX "${CMAKE_IMPORT_LIBRARY_SUFFIX}") diff --git a/Tests/TestsWorkingDirectory/main.c b/Tests/TestsWorkingDirectory/main.c index ca72f21..f856339 100644 --- a/Tests/TestsWorkingDirectory/main.c +++ b/Tests/TestsWorkingDirectory/main.c @@ -5,7 +5,7 @@ #if defined(_WIN32) && \ (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || \ - defined(__MINGW32__)) + defined(__MINGW32__) || defined(__ORANGEC__)) # include <direct.h> # include <io.h> |