diff options
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CMakeLists.txt | 12 | ||||
-rw-r--r-- | Tests/CompileFeatures/CMakeLists.txt | 6 | ||||
-rw-r--r-- | Tests/CompileFeatures/default_dialect.cpp | 12 | ||||
-rw-r--r-- | Tests/Objective-C/cxx-file-extension-test/CMakeLists.txt | 8 | ||||
-rw-r--r-- | Tests/Objective-C/cxx-file-extension-test/main.m | 8 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/C-no-file-stderr.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/C_basic-stderr.txt | 4 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/C_basic-stdout.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/C_basic.cmake | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/C_basic_fullpath-stderr.txt | 4 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/C_basic_fullpath-stdout.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/C_basic_fullpath.cmake | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/C_basic_initial-cache.txt | 5 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/C_buildsrcdir-stderr.txt | 8 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/C_buildsrcdir-stdout.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/Cno-file-stderr.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 15 |
17 files changed, 83 insertions, 11 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 32b580b..b29638b 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2353,6 +2353,18 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Objective-C/c-file-extension-test") + add_test(Objective-C.cxx-file-extension-test ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/Objective-C/cxx-file-extension-test" + "${CMake_BINARY_DIR}/Tests/Objective-C/cxx-file-extension-test" + --build-two-config + ${build_generator_args} + --build-project cxx-file-extension-test + --build-options ${build_options} + --test-command cxx-file-extension-test + ) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Objective-C/cxx-file-extension-test") + add_test(Objective-C.objc-file-extension-test ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/Objective-C/objc-file-extension-test" diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt index 060fb49..ef9198d 100644 --- a/Tests/CompileFeatures/CMakeLists.txt +++ b/Tests/CompileFeatures/CMakeLists.txt @@ -130,6 +130,12 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") endif() if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + if (CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC" + AND CMAKE_CXX_SIMULATE_VERSION VERSION_LESS 19.10) + list(REMOVE_ITEM CXX_non_features + cxx_relaxed_constexpr + ) + endif() if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16.0) if (CMAKE_CXX_COMIPLER_VERSION VERSION_EQUAL 15.0) list(REMOVE_ITEM CXX_non_features diff --git a/Tests/CompileFeatures/default_dialect.cpp b/Tests/CompileFeatures/default_dialect.cpp index 3ee60a6..e6b3ff6 100644 --- a/Tests/CompileFeatures/default_dialect.cpp +++ b/Tests/CompileFeatures/default_dialect.cpp @@ -2,7 +2,17 @@ template <long l> struct Outputter; -#if defined(_MSC_VER) && defined(_MSVC_LANG) +#if defined(__INTEL_COMPILER) && defined(_MSVC_LANG) && _MSVC_LANG < 201403L +# if defined(__INTEL_CXX11_MODE__) +# if defined(__cpp_aggregate_nsdmi) +# define CXX_STD 201402L +# else +# define CXX_STD 201103L +# endif +# else +# define CXX_STD 199711L +# endif +#elif defined(_MSC_VER) && defined(_MSVC_LANG) # define CXX_STD _MSVC_LANG #else # define CXX_STD __cplusplus diff --git a/Tests/Objective-C/cxx-file-extension-test/CMakeLists.txt b/Tests/Objective-C/cxx-file-extension-test/CMakeLists.txt new file mode 100644 index 0000000..eb065e4 --- /dev/null +++ b/Tests/Objective-C/cxx-file-extension-test/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) + +project(cxx-file-extension-test) + +string(APPEND CMAKE_CXX_FLAGS " -std=c++11") +set(CMAKE_CXX_STANDARD 14) + +add_executable(cxx-file-extension-test main.m) diff --git a/Tests/Objective-C/cxx-file-extension-test/main.m b/Tests/Objective-C/cxx-file-extension-test/main.m new file mode 100644 index 0000000..1c159a9 --- /dev/null +++ b/Tests/Objective-C/cxx-file-extension-test/main.m @@ -0,0 +1,8 @@ +#ifndef __OBJC__ +# error "Compiler cannot compile Objective-C" +#endif + +int main() +{ + return 0; +} diff --git a/Tests/RunCMake/CommandLine/C-no-file-stderr.txt b/Tests/RunCMake/CommandLine/C-no-file-stderr.txt index 2a4ee64..b65a349 100644 --- a/Tests/RunCMake/CommandLine/C-no-file-stderr.txt +++ b/Tests/RunCMake/CommandLine/C-no-file-stderr.txt @@ -1,3 +1,3 @@ -^CMake Error: Error processing file: nosuchcachefile.txt +^CMake Error: Error processing file: .*/Tests/RunCMake/CommandLine/C-no-file-build/nosuchcachefile.txt CMake Error: The source directory ".*/Tests/RunCMake/CommandLine/C-no-file-build" does not appear to contain CMakeLists.txt. Specify --help for usage, or press the help button on the CMake GUI.$ diff --git a/Tests/RunCMake/CommandLine/C_basic-stderr.txt b/Tests/RunCMake/CommandLine/C_basic-stderr.txt new file mode 100644 index 0000000..62d0cd5 --- /dev/null +++ b/Tests/RunCMake/CommandLine/C_basic-stderr.txt @@ -0,0 +1,4 @@ +initial-cache.txt: CMAKE_SOURCE_DIR: .*/Tests/RunCMake/CommandLine +initial-cache.txt: CMAKE_BINARY_DIR: .*/Tests/RunCMake/CommandLine/C_basic-build +CMakeLists.txt: INITIAL_SOURCE_DIR: .*/Tests/RunCMake/CommandLine +CMakeLists.txt: INITIAL_BINARY_DIR: .*/Tests/RunCMake/CommandLine/C_basic-build diff --git a/Tests/RunCMake/CommandLine/C_basic-stdout.txt b/Tests/RunCMake/CommandLine/C_basic-stdout.txt new file mode 100644 index 0000000..74a938e --- /dev/null +++ b/Tests/RunCMake/CommandLine/C_basic-stdout.txt @@ -0,0 +1 @@ +loading initial cache file ../C_basic_initial-cache.txt diff --git a/Tests/RunCMake/CommandLine/C_basic.cmake b/Tests/RunCMake/CommandLine/C_basic.cmake new file mode 100644 index 0000000..1a56593 --- /dev/null +++ b/Tests/RunCMake/CommandLine/C_basic.cmake @@ -0,0 +1,2 @@ +message("CMakeLists.txt: INITIAL_SOURCE_DIR: ${INITIAL_SOURCE_DIR}") +message("CMakeLists.txt: INITIAL_BINARY_DIR: ${INITIAL_BINARY_DIR}") diff --git a/Tests/RunCMake/CommandLine/C_basic_fullpath-stderr.txt b/Tests/RunCMake/CommandLine/C_basic_fullpath-stderr.txt new file mode 100644 index 0000000..f382a01 --- /dev/null +++ b/Tests/RunCMake/CommandLine/C_basic_fullpath-stderr.txt @@ -0,0 +1,4 @@ +initial-cache.txt: CMAKE_SOURCE_DIR: .*/Tests/RunCMake/CommandLine +initial-cache.txt: CMAKE_BINARY_DIR: .*/Tests/RunCMake/CommandLine/C_basic_fullpath-build +CMakeLists.txt: INITIAL_SOURCE_DIR: .*/Tests/RunCMake/CommandLine +CMakeLists.txt: INITIAL_BINARY_DIR: .*/Tests/RunCMake/CommandLine/C_basic_fullpath-build diff --git a/Tests/RunCMake/CommandLine/C_basic_fullpath-stdout.txt b/Tests/RunCMake/CommandLine/C_basic_fullpath-stdout.txt new file mode 100644 index 0000000..32724f5 --- /dev/null +++ b/Tests/RunCMake/CommandLine/C_basic_fullpath-stdout.txt @@ -0,0 +1 @@ +loading initial cache file .*/Tests/RunCMake/CommandLine/C_basic_initial-cache.txt diff --git a/Tests/RunCMake/CommandLine/C_basic_fullpath.cmake b/Tests/RunCMake/CommandLine/C_basic_fullpath.cmake new file mode 100644 index 0000000..1a56593 --- /dev/null +++ b/Tests/RunCMake/CommandLine/C_basic_fullpath.cmake @@ -0,0 +1,2 @@ +message("CMakeLists.txt: INITIAL_SOURCE_DIR: ${INITIAL_SOURCE_DIR}") +message("CMakeLists.txt: INITIAL_BINARY_DIR: ${INITIAL_BINARY_DIR}") diff --git a/Tests/RunCMake/CommandLine/C_basic_initial-cache.txt b/Tests/RunCMake/CommandLine/C_basic_initial-cache.txt new file mode 100644 index 0000000..e7a8ac9 --- /dev/null +++ b/Tests/RunCMake/CommandLine/C_basic_initial-cache.txt @@ -0,0 +1,5 @@ +set(INITIAL_SOURCE_DIR "${CMAKE_SOURCE_DIR}" CACHE PATH "defined in initial.cmake") +set(INITIAL_BINARY_DIR "${CMAKE_BINARY_DIR}" CACHE PATH "defined in initial.cmake") + +message("initial-cache.txt: CMAKE_SOURCE_DIR: ${CMAKE_SOURCE_DIR}") +message("initial-cache.txt: CMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR}") diff --git a/Tests/RunCMake/CommandLine/C_buildsrcdir-stderr.txt b/Tests/RunCMake/CommandLine/C_buildsrcdir-stderr.txt index 0d8f72e..4720a6f 100644 --- a/Tests/RunCMake/CommandLine/C_buildsrcdir-stderr.txt +++ b/Tests/RunCMake/CommandLine/C_buildsrcdir-stderr.txt @@ -1,8 +1,8 @@ initial-cache.txt: CMAKE_SOURCE_DIR: .*/C_buildsrcdir/src -initial-cache.txt: CMAKE_BINARY_DIR: .*/C_buildsrcdir-build/DummyBuildDir +initial-cache.txt: CMAKE_BINARY_DIR: .*/ExplicitDirs-build/DummyBuildDir PreLoad.cmake: CMAKE_SOURCE_DIR: .*/C_buildsrcdir/src -PreLoad.cmake: CMAKE_BINARY_DIR: .*/C_buildsrcdir-build/DummyBuildDir +PreLoad.cmake: CMAKE_BINARY_DIR: .*/ExplicitDirs-build/DummyBuildDir CMakeLists.txt: INITIAL_SOURCE_DIR: .*/C_buildsrcdir/src -CMakeLists.txt: INITIAL_BINARY_DIR: .*/C_buildsrcdir-build/DummyBuildDir +CMakeLists.txt: INITIAL_BINARY_DIR: .*/ExplicitDirs-build/DummyBuildDir CMakeLists.txt: PRELOAD_SOURCE_DIR: .*/C_buildsrcdir/src -CMakeLists.txt: PRELOAD_BINARY_DIR: .*/C_buildsrcdir-build/DummyBuildDir +CMakeLists.txt: PRELOAD_BINARY_DIR: .*/ExplicitDirs-build/DummyBuildDir diff --git a/Tests/RunCMake/CommandLine/C_buildsrcdir-stdout.txt b/Tests/RunCMake/CommandLine/C_buildsrcdir-stdout.txt index c69b11e..862cfeb 100644 --- a/Tests/RunCMake/CommandLine/C_buildsrcdir-stdout.txt +++ b/Tests/RunCMake/CommandLine/C_buildsrcdir-stdout.txt @@ -1,2 +1,2 @@ -loading initial cache file .*/C_buildsrcdir/initial-cache.txt +loading initial cache file .*initial-cache.txt .* diff --git a/Tests/RunCMake/CommandLine/Cno-file-stderr.txt b/Tests/RunCMake/CommandLine/Cno-file-stderr.txt index 67a2032..416686c 100644 --- a/Tests/RunCMake/CommandLine/Cno-file-stderr.txt +++ b/Tests/RunCMake/CommandLine/Cno-file-stderr.txt @@ -1,3 +1,3 @@ -^CMake Error: Error processing file: nosuchcachefile.txt +^CMake Error: Error processing file: .*/Tests/RunCMake/CommandLine/Cno-file-build/nosuchcachefile.txt CMake Error: The source directory ".*/Tests/RunCMake/CommandLine/Cno-file-build" does not appear to contain CMakeLists.txt. Specify --help for usage, or press the help button on the CMake GUI.$ diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index efd1cc2..b608d33 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -110,6 +110,14 @@ project(ExplicitDirsMissing LANGUAGES NONE) file(REMOVE_RECURSE "${binary_dir}") run_cmake_with_options(B-S -B${binary_dir} -S${source_dir}) + message("copied to ${RunCMake_TEST_BINARY_DIR}/initial-cache.txt") + file(COPY ${RunCMake_SOURCE_DIR}/C_buildsrcdir/initial-cache.txt DESTINATION ${RunCMake_TEST_BINARY_DIR}) + + # CMAKE_BINARY_DIR should be determined by -B if specified, and CMAKE_SOURCE_DIR determined by -S if specified. + # Path to initial-cache.txt is relative to the $PWD, which is normally set to ${RunCMake_TEST_BINARY_DIR}. + run_cmake_with_options(C_buildsrcdir -B DummyBuildDir -S ${RunCMake_SOURCE_DIR}/C_buildsrcdir/src -C initial-cache.txt) + # Test that full path works, too. + run_cmake_with_options(C_buildsrcdir -B DummyBuildDir -S ${RunCMake_SOURCE_DIR}/C_buildsrcdir/src -C ${RunCMake_TEST_BINARY_DIR}/initial-cache.txt) endfunction() run_ExplicitDirs() @@ -406,9 +414,10 @@ run_cmake_command(P_working-dir ${CMAKE_COMMAND} -DEXPECTED_WORKING_DIR=${RunCMa # Tests the values of CMAKE_BINARY_DIR CMAKE_CURRENT_BINARY_DIR CMAKE_SOURCE_DIR CMAKE_CURRENT_SOURCE_DIR. run_cmake_command(P_working-dir ${CMAKE_COMMAND} -DEXPECTED_WORKING_DIR=${RunCMake_BINARY_DIR}/P_working-dir-build -P ${RunCMake_SOURCE_DIR}/P_working-dir.cmake -S something_else -B something_else_1) -# CMAKE_BINARY_DIR should be determined by -B if specified, and CMAKE_SOURCE_DIR determined by -S if specified. -run_cmake_with_options(C_buildsrcdir -B DummyBuildDir -S ${RunCMake_SOURCE_DIR}/C_buildsrcdir/src -C ${RunCMake_SOURCE_DIR}/C_buildsrcdir/initial-cache.txt) - +# Place an initial cache where C_basic will find it when passed the relative path "..". +file(COPY ${RunCMake_SOURCE_DIR}/C_basic_initial-cache.txt DESTINATION ${RunCMake_BINARY_DIR}) +run_cmake_with_options(C_basic -C ../C_basic_initial-cache.txt) +run_cmake_with_options(C_basic_fullpath -C ${RunCMake_BINARY_DIR}/C_basic_initial-cache.txt) set(RunCMake_TEST_OPTIONS "-DFOO=-DBAR:BOOL=BAZ") |