diff options
31 files changed, 248 insertions, 63 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f321d33..bfc713f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -314,6 +314,33 @@ b:debian10-makefiles-inplace: variables: CMAKE_CI_JOB_NIGHTLY: "true" +b:debian10-extdeps: + extends: + - .debian10_extdeps + - .cmake_build_linux_standalone + - .linux_builder_tags + - .run_manually + variables: + CMAKE_CI_JOB_NIGHTLY: "true" + +b:debian10-aarch64-extdeps: + extends: + - .debian10_aarch64_extdeps + - .cmake_build_linux_standalone + - .linux_builder_tags_aarch64 + - .run_manually + variables: + CMAKE_CI_JOB_NIGHTLY: "true" + +b:fedora36-extdeps: + extends: + - .fedora36_extdeps + - .cmake_build_linux_standalone + - .linux_builder_tags + - .run_manually + variables: + CMAKE_CI_JOB_NIGHTLY: "true" + t:fedora36-ninja: extends: - .fedora36_ninja diff --git a/.gitlab/ci/cmake.ps1 b/.gitlab/ci/cmake.ps1 index bea3286..98aeae3 100755 --- a/.gitlab/ci/cmake.ps1 +++ b/.gitlab/ci/cmake.ps1 @@ -1,7 +1,7 @@ $erroractionpreference = "stop" -$version = "3.24.0-rc1" -$sha256sum = "8D075F5C663263713008FB77E31956C808D3A30074C3655F16EB76A0800F99D6" +$version = "3.24.1" +$sha256sum = "C1B17431A16337D517F7BA78C7067B6F143A12686CB8087F3DD32F3FA45F5AAE" $filename = "cmake-$version-windows-x86_64" $tarball = "$filename.zip" diff --git a/.gitlab/ci/cmake.sh b/.gitlab/ci/cmake.sh index 0d52e19..137da06 100755 --- a/.gitlab/ci/cmake.sh +++ b/.gitlab/ci/cmake.sh @@ -2,22 +2,22 @@ set -e -readonly version="3.24.0-rc1" +readonly version="3.24.1" case "$(uname -s)-$(uname -m)" in Linux-x86_64) shatool="sha256sum" - sha256sum="183ff011a2177d0a683e81d645d02c0ed8ff790449158522928ef069775091cc" + sha256sum="827bf068cfaa23a9fb95f990c9f8a7ed8f2caeb3af62b5c0a2fed7a8dd6dde3e" platform="linux-x86_64" ;; Linux-aarch64) shatool="sha256sum" - sha256sum="f26642d5bc503de6bf7dd2d06afb8777d5862aa44e556cdf4155fec60e534d04" + sha256sum="d50c40135df667ed659f8e4eb7cf7d53421250304f7b3e1a70af9cf3d0f2ab18" platform="linux-aarch64" ;; Darwin-*) shatool="shasum -a 256" - sha256sum="417fde30f2cf96f53eaf27b1e510924ce441f0449e53974f2156cb19d32978b9" + sha256sum="71bb8db69826d74c395a3c3bbf8b773dbe9f54a2c7331266ba70da303e9c97a1" platform="macos-universal" ;; *) diff --git a/.gitlab/ci/configure_debian10_aarch64_extdeps.cmake b/.gitlab/ci/configure_debian10_aarch64_extdeps.cmake new file mode 100644 index 0000000..8e545f5 --- /dev/null +++ b/.gitlab/ci/configure_debian10_aarch64_extdeps.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_LIST_DIR}/configure_extdeps_common.cmake") diff --git a/.gitlab/ci/configure_debian10_extdeps.cmake b/.gitlab/ci/configure_debian10_extdeps.cmake new file mode 100644 index 0000000..8e545f5 --- /dev/null +++ b/.gitlab/ci/configure_debian10_extdeps.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_LIST_DIR}/configure_extdeps_common.cmake") diff --git a/.gitlab/ci/configure_extdeps_common.cmake b/.gitlab/ci/configure_extdeps_common.cmake new file mode 100644 index 0000000..2c7d328 --- /dev/null +++ b/.gitlab/ci/configure_extdeps_common.cmake @@ -0,0 +1,5 @@ +set(CMAKE_USE_SYSTEM_LIBRARIES ON CACHE BOOL "") +set(CMAKE_SKIP_BOOTSTRAP_TEST ON CACHE BOOL "") +set(CMake_TEST_Qt6 OFF CACHE BOOL "") + +include("${CMAKE_CURRENT_LIST_DIR}/configure_common.cmake") diff --git a/.gitlab/ci/configure_fedora36_extdeps.cmake b/.gitlab/ci/configure_fedora36_extdeps.cmake new file mode 100644 index 0000000..8e545f5 --- /dev/null +++ b/.gitlab/ci/configure_fedora36_extdeps.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_LIST_DIR}/configure_extdeps_common.cmake") diff --git a/.gitlab/ci/ctest_standalone.cmake b/.gitlab/ci/ctest_standalone.cmake index 9199693..36ba71c 100644 --- a/.gitlab/ci/ctest_standalone.cmake +++ b/.gitlab/ci/ctest_standalone.cmake @@ -3,8 +3,8 @@ cmake_minimum_required(VERSION 3.8) include("${CMAKE_CURRENT_LIST_DIR}/gitlab_ci.cmake") include("${CMAKE_CURRENT_LIST_DIR}/env_$ENV{CMAKE_CONFIGURATION}.cmake" OPTIONAL) -set(cmake_args - -C "${CMAKE_CURRENT_LIST_DIR}/configure_$ENV{CMAKE_CONFIGURATION}.cmake") +set(initial_cache "${CMAKE_CURRENT_LIST_DIR}/configure_$ENV{CMAKE_CONFIGURATION}.cmake") +set(cmake_args -C "${initial_cache}") include(ProcessorCount) ProcessorCount(nproc) @@ -25,6 +25,8 @@ ctest_update() if("$ENV{CMAKE_CI_BOOTSTRAP}") set(CTEST_CONFIGURE_COMMAND "\"${CTEST_SOURCE_DIRECTORY}/bootstrap\" --parallel=${nproc}") +elseif("$ENV{CMAKE_CONFIGURATION}" MATCHES "extdeps") + set(CTEST_CONFIGURE_COMMAND "/opt/extdeps/bin/cmake -C \"${initial_cache}\" -G \"${CTEST_CMAKE_GENERATOR}\" \"${CTEST_SOURCE_DIRECTORY}\"") endif() # Configure the project. diff --git a/.gitlab/ci/docker/debian10-aarch64/install_deps.sh b/.gitlab/ci/docker/debian10-aarch64/install_deps.sh index 3dd814d..9a98538 100755 --- a/.gitlab/ci/docker/debian10-aarch64/install_deps.sh +++ b/.gitlab/ci/docker/debian10-aarch64/install_deps.sh @@ -14,6 +14,20 @@ apt-get install -y \ curl \ git +# Install optional external build dependencies. +apt-get install -y \ + libarchive-dev \ + libbz2-dev \ + libcurl4-gnutls-dev \ + libexpat1-dev \ + libjsoncpp-dev \ + liblzma-dev \ + libncurses-dev \ + librhash-dev \ + libuv1-dev \ + libzstd-dev \ + zlib1g-dev + # Install iwyu runtime deps. apt-get install -y \ clang-6.0 \ diff --git a/.gitlab/ci/docker/debian10/install_deps.sh b/.gitlab/ci/docker/debian10/install_deps.sh index f796816..36ef508 100755 --- a/.gitlab/ci/docker/debian10/install_deps.sh +++ b/.gitlab/ci/docker/debian10/install_deps.sh @@ -14,6 +14,20 @@ apt-get install -y \ curl \ git +# Install optional external build dependencies. +apt-get install -y \ + libarchive-dev \ + libbz2-dev \ + libcurl4-gnutls-dev \ + libexpat1-dev \ + libjsoncpp-dev \ + liblzma-dev \ + libncurses-dev \ + librhash-dev \ + libuv1-dev \ + libzstd-dev \ + zlib1g-dev + # Install iwyu runtime deps. apt-get install -y \ clang-6.0 \ diff --git a/.gitlab/ci/docker/fedora36/install_deps.sh b/.gitlab/ci/docker/fedora36/install_deps.sh index b8ddfb9..141e540 100755 --- a/.gitlab/ci/docker/fedora36/install_deps.sh +++ b/.gitlab/ci/docker/fedora36/install_deps.sh @@ -17,6 +17,20 @@ dnf install --setopt=install_weak_deps=False -y \ git-core \ make +# Install optional external build dependencies. +dnf install --setopt=install_weak_deps=False -y \ + bzip2-devel \ + expat-devel \ + jsoncpp-devel \ + libarchive-devel \ + libcurl-devel \ + libuv-devel \ + libuv-devel \ + libzstd-devel \ + rhash-devel \ + xz-devel \ + zlib-devel + # Install documentation tools. dnf install --setopt=install_weak_deps=False -y \ python3-sphinx \ diff --git a/.gitlab/ci/env_debian10_aarch64_extdeps.sh b/.gitlab/ci/env_debian10_aarch64_extdeps.sh new file mode 100644 index 0000000..7076e18 --- /dev/null +++ b/.gitlab/ci/env_debian10_aarch64_extdeps.sh @@ -0,0 +1 @@ +source .gitlab/ci/env_extdeps_common.sh diff --git a/.gitlab/ci/env_debian10_extdeps.sh b/.gitlab/ci/env_debian10_extdeps.sh new file mode 100644 index 0000000..7076e18 --- /dev/null +++ b/.gitlab/ci/env_debian10_extdeps.sh @@ -0,0 +1 @@ +source .gitlab/ci/env_extdeps_common.sh diff --git a/.gitlab/ci/env_extdeps_common.sh b/.gitlab/ci/env_extdeps_common.sh new file mode 100644 index 0000000..8cabc05 --- /dev/null +++ b/.gitlab/ci/env_extdeps_common.sh @@ -0,0 +1,5 @@ +.gitlab/ci/extdeps-linux.sh + +export CMAKE_PREFIX_PATH=/opt/extdeps +export PATH=/opt/extdeps/bin:$PATH +export LD_LIBRARY_PATH=/opt/extdeps/lib diff --git a/.gitlab/ci/env_fedora36_extdeps.sh b/.gitlab/ci/env_fedora36_extdeps.sh new file mode 100644 index 0000000..7076e18 --- /dev/null +++ b/.gitlab/ci/env_fedora36_extdeps.sh @@ -0,0 +1 @@ +source .gitlab/ci/env_extdeps_common.sh diff --git a/.gitlab/ci/extdeps-linux.sh b/.gitlab/ci/extdeps-linux.sh new file mode 100755 index 0000000..f0d4c0d --- /dev/null +++ b/.gitlab/ci/extdeps-linux.sh @@ -0,0 +1,62 @@ +#!/bin/sh + +set -e + +mkdir -p /opt/extdeps/src +cd /opt/extdeps/src +export PATH=/opt/extdeps/bin:$PATH + +#---------------------------------------------------------------------------- +# cmake + +case "$(uname -s)-$(uname -m)" in + Linux-x86_64) + cmake_version="3.13.5" + cmake_sha256sum="e2fd0080a6f0fc1ec84647acdcd8e0b4019770f48d83509e6a5b0b6ea27e5864" + cmake_platform="Linux-x86_64" + ;; + Linux-aarch64) + cmake_version="3.19.8" + cmake_sha256sum="807f5afb2a560e00af9640e496d5673afefc2888bf0ed076412884a5ebb547a1" + cmake_platform="Linux-aarch64" + ;; + *) + echo "Unrecognized platform $(uname -s)-$(uname -m)" + exit 1 + ;; +esac +readonly shatool +readonly cmake_sha256sum +readonly cmake_platform + +readonly cmake_filename="cmake-$cmake_version-$cmake_platform" +readonly cmake_tarball="$cmake_filename.tar.gz" + +echo "$cmake_sha256sum $cmake_tarball" > cmake.sha256sum +curl -OL "https://github.com/Kitware/CMake/releases/download/v$cmake_version/$cmake_tarball" +sha256sum --check cmake.sha256sum +tar xzf "$cmake_tarball" -C /opt/extdeps --strip-components=1 +rm -f "$cmake_tarball" cmake.sha256sum + +#---------------------------------------------------------------------------- +# libuv + +curl -L -o libuv-1.28.0.tar.gz https://github.com/libuv/libuv/archive/refs/tags/v1.28.0.tar.gz +tar xzf libuv-1.28.0.tar.gz +cmake -S libuv-1.28.0 -B libuv-1.28.0-build \ + -DCMAKE_INSTALL_PREFIX=/opt/extdeps +cmake --build libuv-1.28.0-build --target install +rm -rf libuv-1.28.0* + +#---------------------------------------------------------------------------- +# jsoncpp + +curl -L -o jsoncpp-1.6.0.tar.gz https://github.com/open-source-parsers/jsoncpp/archive/refs/tags/1.6.0.tar.gz +tar xzf jsoncpp-1.6.0.tar.gz +cmake -S jsoncpp-1.6.0 -B jsoncpp-1.6.0-build \ + -DCMAKE_BUILD_TYPE=Release \ + -DJSONCPP_LIB_BUILD_STATIC=ON \ + -DJSONCPP_LIB_BUILD_SHARED=ON \ + -DCMAKE_INSTALL_PREFIX=/opt/extdeps +cmake --build jsoncpp-1.6.0-build --target install +rm -rf jsoncpp-1.6.0* diff --git a/.gitlab/os-linux.yml b/.gitlab/os-linux.yml index 37e5c22..765518a 100644 --- a/.gitlab/os-linux.yml +++ b/.gitlab/os-linux.yml @@ -45,7 +45,7 @@ ### Debian .debian10: - image: "kitware/cmake:ci-debian10-x86_64-2022-06-21" + image: "kitware/cmake:ci-debian10-x86_64-2022-08-17" variables: GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci" @@ -60,7 +60,7 @@ CMAKE_CI_NO_INSTALL: 1 .debian10_aarch64: - image: "kitware/cmake:ci-debian10-aarch64-2022-06-21" + image: "kitware/cmake:ci-debian10-aarch64-2022-08-17" variables: GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci" @@ -69,7 +69,7 @@ ### Fedora .fedora36: - image: "kitware/cmake:ci-fedora36-x86_64-2022-06-21" + image: "kitware/cmake:ci-fedora36-x86_64-2022-08-17" variables: GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci/long file name for testing purposes" @@ -137,6 +137,30 @@ CMAKE_CI_NO_INSTALL: 1 CTEST_NO_WARNINGS_ALLOWED: 1 +.debian10_extdeps: + extends: .debian10 + + variables: + CMAKE_CONFIGURATION: debian10_extdeps + CMAKE_CI_BUILD_TYPE: Release + CTEST_NO_WARNINGS_ALLOWED: 1 + +.debian10_aarch64_extdeps: + extends: .debian10_aarch64 + + variables: + CMAKE_CONFIGURATION: debian10_aarch64_extdeps + CMAKE_CI_BUILD_TYPE: Release + CTEST_NO_WARNINGS_ALLOWED: 1 + +.fedora36_extdeps: + extends: .fedora36 + + variables: + CMAKE_CONFIGURATION: fedora36_extdeps + CMAKE_CI_BUILD_TYPE: Release + CTEST_NO_WARNINGS_ALLOWED: 1 + .fedora36_ninja: extends: .fedora36 diff --git a/CMakeLists.txt b/CMakeLists.txt index 267518b..9d77dfc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -648,7 +648,7 @@ macro (CMAKE_BUILD_UTILITIES) #--------------------------------------------------------------------- # Build jsoncpp library. if(CMAKE_USE_SYSTEM_JSONCPP) - find_package(JsonCpp 1.4.1) + find_package(JsonCpp 1.6.0) if(NOT JsonCpp_FOUND) message(FATAL_ERROR "CMAKE_USE_SYSTEM_JSONCPP is ON but a JsonCpp is not found!") diff --git a/Help/manual/cmake-language.7.rst b/Help/manual/cmake-language.7.rst index 02cfa7e..16917ff 100644 --- a/Help/manual/cmake-language.7.rst +++ b/Help/manual/cmake-language.7.rst @@ -391,8 +391,8 @@ Variable References A *variable reference* has the form ``${<variable>}`` and is evaluated inside a `Quoted Argument`_ or an `Unquoted Argument`_. -A variable reference is replaced by the value of the variable, -or by the empty string if the variable is not set. +A variable reference is replaced by the value of the specified +variable or cache entry, or if neither is set, by the empty string. Variable references can nest and are evaluated from the inside out, e.g. ``${outer_${inner_variable}_variable}``. @@ -408,14 +408,16 @@ and how their values are set. An *environment variable reference* has the form ``$ENV{<variable>}``. See the `Environment Variables`_ section for more information. -A *cache variable reference* has the form ``$CACHE{<variable>}``. +A *cache variable reference* has the form ``$CACHE{<variable>}``, +and is replaced by the value of the specified cache entry without +checking for a normal variable of the same name. If the cache +entry does not exist, it is replaced by the empty string. See :variable:`CACHE` for more information. The :command:`if` command has a special condition syntax that allows for variable references in the short form ``<variable>`` -instead of ``${<variable>}``. -However, environment and cache variables always need to be -referenced as ``$ENV{<variable>}`` or ``$CACHE{<variable>}``. +instead of ``${<variable>}``. However, environment variables +always need to be referenced as ``$ENV{<variable>}``. Comments -------- diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index 7eaf3fa..8cec9d4 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -537,7 +537,7 @@ following options: Lists the available build presets. The current working directory must contain CMake preset files. -.. option:: --parallel [<jobs>], -j [<jobs>] +.. option:: -j [<jobs>], --parallel [<jobs>] The maximum number of concurrent processes to use when building. If ``<jobs>`` is omitted the native build tool's default number is used. diff --git a/Modules/CMakeTestCUDACompiler.cmake b/Modules/CMakeTestCUDACompiler.cmake index 853d655..a6d0f8b 100644 --- a/Modules/CMakeTestCUDACompiler.cmake +++ b/Modules/CMakeTestCUDACompiler.cmake @@ -126,10 +126,8 @@ list(REMOVE_ITEM CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES ${CMAKE_CUDA_IMPLICIT_LINK_L if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA") # Remove the CUDA Toolkit include directories from the set of # implicit system include directories. - # This resolves the issue that NVCC doesn't specify these - # includes as SYSTEM includes when compiling device code, and sometimes - # they contain headers that generate warnings, so let users mark them - # as SYSTEM explicitly + # CMake will explicitly mark these as SYSTEM to NVCC since it implicitly + # adds them as user includes and not system if(CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES) list(REMOVE_ITEM CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES} diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 6ba211e..1a3547e 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 24) -set(CMake_VERSION_PATCH 20220819) +set(CMake_VERSION_PATCH 20220820) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 4feae6d..07ad1e8 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1854,6 +1854,15 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo() cmExpandedList(standardIncludesStr); standardIncludesSet.insert(standardIncludesVec.begin(), standardIncludesVec.end()); + if (li == "CUDA") { + std::string const& cudaSystemIncludeVar = + mf->GetSafeDefinition("CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES"); + std::vector<std::string> cudaToolkitIncludeVec = + cmExpandedList(cudaSystemIncludeVar); + standardIncludesSet.insert(cudaToolkitIncludeVec.begin(), + cudaToolkitIncludeVec.end()); + mf->AddIncludeDirectories(cudaToolkitIncludeVec); + } } mf->AddSystemIncludeDirectories(standardIncludesSet); } diff --git a/Tests/CudaOnly/CMakeLists.txt b/Tests/CudaOnly/CMakeLists.txt index 091872d..d23e929 100644 --- a/Tests/CudaOnly/CMakeLists.txt +++ b/Tests/CudaOnly/CMakeLists.txt @@ -27,10 +27,12 @@ if(CMake_TEST_CUDA AND NOT CMake_TEST_CUDA STREQUAL "Clang") add_cuda_test_macro(CudaOnly.GPUDebugFlag CudaOnlyGPUDebugFlag) endif() -# The CUDA only ships the shared version of the toolkit libraries -# on windows if(NOT WIN32) + # The CUDA only ships the shared version of the toolkit libraries + # on windows add_cuda_test_macro(CudaOnly.StaticRuntimePlusToolkit CudaOnlyStaticRuntimePlusToolkit) + # `isystem` behaves differently on windows with nvcc + add_cuda_test_macro(CudaOnly.ToolkitIsSystemInclude CudaOnlySystemInclude) endif() add_cuda_test_macro(CudaOnly.DeviceLTO CudaOnlyDeviceLTO) diff --git a/Tests/CudaOnly/ToolkitIsSystemInclude/CMakeLists.txt b/Tests/CudaOnly/ToolkitIsSystemInclude/CMakeLists.txt new file mode 100644 index 0000000..bc347dd --- /dev/null +++ b/Tests/CudaOnly/ToolkitIsSystemInclude/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.24) +project(ToolkitIsSystemInclude CUDA) + +# Verify that the nvrtc.h that is inside `CMAKE_CURRENT_SOURCE_DIR` is still +# the first include for `.cu` files. +add_executable(CudaOnlySystemInclude main.cu) +target_include_directories(CudaOnlySystemInclude SYSTEM PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include) diff --git a/Tests/CudaOnly/ToolkitIsSystemInclude/include/nvrtc.h b/Tests/CudaOnly/ToolkitIsSystemInclude/include/nvrtc.h new file mode 100644 index 0000000..5a015c4 --- /dev/null +++ b/Tests/CudaOnly/ToolkitIsSystemInclude/include/nvrtc.h @@ -0,0 +1,5 @@ +#define CMAKE_CUDA_TOOLKIT_IS_SYSTEM 1 + +int main() +{ +} diff --git a/Tests/CudaOnly/ToolkitIsSystemInclude/main.cu b/Tests/CudaOnly/ToolkitIsSystemInclude/main.cu new file mode 100644 index 0000000..6cff8a1 --- /dev/null +++ b/Tests/CudaOnly/ToolkitIsSystemInclude/main.cu @@ -0,0 +1,4 @@ +#include "nvrtc.h" +#ifndef CMAKE_CUDA_TOOLKIT_IS_SYSTEM +# error "Failed to specify the CUDA Toolkit includes as system" +#endif diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index ec89188..2485a7e 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -305,6 +305,9 @@ add_RunCMake_test(ExportImport) add_RunCMake_test(ExternalData) add_RunCMake_test(FeatureSummary) add_RunCMake_test(FPHSA) +if(CMAKE_USE_SYSTEM_JSONCPP) + list(APPEND FileAPI_ARGS -DJsonCpp_VERSION_STRING=${JsonCpp_VERSION_STRING}) +endif() add_RunCMake_test(FileAPI -DPython_EXECUTABLE=${Python_EXECUTABLE} -DCMAKE_CXX_COMPILER_ID=${CMAKE_CXX_COMPILER_ID}) add_RunCMake_test(FindBoost) diff --git a/Tests/RunCMake/FileAPI/ClientStateful-check.py b/Tests/RunCMake/FileAPI/ClientStateful-check.py index f3d20d1..28679bb 100644 --- a/Tests/RunCMake/FileAPI/ClientStateful-check.py +++ b/Tests/RunCMake/FileAPI/ClientStateful-check.py @@ -108,7 +108,11 @@ def check_query_json_empty(q): check_error_re(q, "value, object or array expected") def check_query_json_extra(q): - check_error_re(q, "Extra non-whitespace after JSON value") + if bool(os.environ.get("CMake_JSONCPP_PRE_1_7_5", "")) and is_dict(q) and sorted(q.keys()) == ["responses"]: + # jsoncpp < 1.7.5 did not diagnose extra non-whitespace characters + check_error(q["responses"], "'requests' member missing") + else: + check_error_re(q, "Extra non-whitespace after JSON value") def check_query_not_file(q): check_error_re(q, "failed to read from file") diff --git a/Tests/RunCMake/FileAPI/RunCMakeTest.cmake b/Tests/RunCMake/FileAPI/RunCMakeTest.cmake index 61dce17..961b73a 100644 --- a/Tests/RunCMake/FileAPI/RunCMakeTest.cmake +++ b/Tests/RunCMake/FileAPI/RunCMakeTest.cmake @@ -39,6 +39,10 @@ if(RunCMake_GENERATOR_IS_MULTI_CONFIG) set(RunCMake_TEST_OPTIONS "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release\\;MinSizeRel\\;RelWithDebInfo") endif() +if(JsonCpp_VERSION_STRING AND JsonCpp_VERSION_STRING VERSION_LESS 1.7.5) + set(ENV{CMake_JSONCPP_PRE_1_7_5} 1) +endif() + run_cmake(Nothing) run_cmake(Empty) run_cmake(EmptyClient) diff --git a/Tests/TryCompile/CMakeLists.txt b/Tests/TryCompile/CMakeLists.txt index 7c6f970..dccc227 100644 --- a/Tests/TryCompile/CMakeLists.txt +++ b/Tests/TryCompile/CMakeLists.txt @@ -30,6 +30,15 @@ endmacro() # try to compile a file that should compile +try_compile(SHOULD_PASS + ${TryCompile_BINARY_DIR} + ${TryCompile_SOURCE_DIR}/pass.c + OUTPUT_VARIABLE TRY_OUT) +if(NOT SHOULD_PASS) + message(SEND_ERROR "should pass failed ${TRY_OUT}") +endif() + +# try to compile a file that should compile # also check that COPY_FILE works try_compile(SHOULD_PASS ${TryCompile_BINARY_DIR} @@ -73,24 +82,6 @@ if(SHOULD_FAIL) message(SEND_ERROR "Should fail passed ${TRY_OUT}") endif() -# try to compile a file that should compile -try_compile(SHOULD_PASS - ${TryCompile_BINARY_DIR} - ${TryCompile_SOURCE_DIR}/pass.c - OUTPUT_VARIABLE TRY_OUT) -if(NOT SHOULD_PASS) - message(SEND_ERROR "should pass failed ${TRY_OUT}") -endif() - -# try to compile a file that should not compile -try_compile(SHOULD_FAIL - ${TryCompile_BINARY_DIR} - ${TryCompile_SOURCE_DIR}/fail.c - OUTPUT_VARIABLE TRY_OUT) -if(SHOULD_FAIL) - message(SEND_ERROR "Should fail passed ${TRY_OUT}") -endif() - # try to compile two files that should compile try_compile(SHOULD_PASS ${TryCompile_BINARY_DIR} @@ -125,24 +116,6 @@ if(NOT SHOULD_PASS) endif() set(CMAKE_C_FLAGS "${_c_flags}") -if(NOT SHOULD_FAIL) - if(SHOULD_PASS) - message("All Tests passed, ignore all previous output.") - else() - message("Test failed") - endif() -else() - message("Test failed") -endif() -try_compile(CMAKE_ANSI_FOR_SCOPE - ${TryCompile_BINARY_DIR} - ${CMAKE_ROOT}/Modules/TestForAnsiForScope.cxx OUTPUT_VARIABLE OUT) -if (CMAKE_ANSI_FOR_SCOPE) - message("Compiler supports ansi for") -else() - message("Compiler does not support ansi for scope") -endif() - try_compile(CMAKE_ANSI_FOR_SCOPE ${TryCompile_BINARY_DIR} ${CMAKE_ROOT}/Modules/TestForAnsiForScope.cxx OUTPUT_VARIABLE OUT) @@ -160,6 +133,7 @@ else() message("Compiler does not support ansi for scope") endif() +# try to compile a project message("Testing try_compile project mode") try_compile(TEST_INNER ${TryCompile_BINARY_DIR}/CMakeFiles/Inner |