diff options
Diffstat (limited to 'Tests')
35 files changed, 286 insertions, 14 deletions
diff --git a/Tests/FindPython/ArtifactsInteractive/CMakeLists.txt b/Tests/FindPython/ArtifactsInteractive/CMakeLists.txt new file mode 100644 index 0000000..524be92 --- /dev/null +++ b/Tests/FindPython/ArtifactsInteractive/CMakeLists.txt @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestArtifactsInteractive LANGUAGES C) + +set (components Interpreter Development) +if (CMake_TEST_FindPython_NumPy) + list (APPEND components NumPy) +endif() + +find_package(Python3 REQUIRED COMPONENTS ${components}) + +if (Python3_ARTIFACTS_INTERACTIVE) + if (NOT DEFINED CACHE{Python3_EXECUTABLE} + OR NOT DEFINED CACHE{Python3_LIBRARY} OR NOT DEFINED CACHE{Python3_INCLUDE_DIR} + OR (CMake_TEST_FindPython_NumPy AND NOT DEFINED CACHE{Python3_NumPy_INCLUDE_DIR})) + message (FATAL_ERROR "Python3_ARTIFACTS_INTERACTIVE=ON Failed.") + endif() +else() + if (DEFINED CACHE{Python3_EXECUTABLE} + OR DEFINED CACHE{Python3_LIBRARY} OR DEFINED CACHE{Python3_INCLUDE_DIR} + OR (CMake_TEST_FindPython_NumPy AND DEFINED CACHE{Python3_NumPy_INCLUDE_DIR})) + message (FATAL_ERROR "Python3_ARTIFACTS_INTERACTIVE=OFF Failed.") + endif() +endif() diff --git a/Tests/FindPython/CMakeLists.txt b/Tests/FindPython/CMakeLists.txt index bfec986..bd6e8ab 100644 --- a/Tests/FindPython/CMakeLists.txt +++ b/Tests/FindPython/CMakeLists.txt @@ -134,6 +134,35 @@ if(CMake_TEST_FindPython) --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) + add_test(NAME FindPython.ArtifactsInteractive.ON COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/ArtifactsInteractive" + "${CMake_BINARY_DIR}/Tests/FindPython/ArtifactsInteractive.ON" + ${build_generator_args} + --build-project TestArtifactsScope + --build-options ${build_options} "-Dbuild_generator_args=${build_generator_args}" + "-DCMake_SOURCE_DIR=${CMake_SOURCE_DIR}" + "-DCMake_BINARY_DIR=${CMake_BINARY_DIR}" + "-DCMake_TEST_FindPython_NumPy=${CMake_TEST_FindPython_NumPy}" + "-DPython3_ARTIFACTS_INTERACTIVE=ON" + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + add_test(NAME FindPython.ArtifactsInteractive.OFF COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/ArtifactsInteractive" + "${CMake_BINARY_DIR}/Tests/FindPython/ArtifactsInteractive.OFF" + ${build_generator_args} + --build-project TestArtifactsScope + --build-options ${build_options} "-Dbuild_generator_args=${build_generator_args}" + "-DCMake_SOURCE_DIR=${CMake_SOURCE_DIR}" + "-DCMake_BINARY_DIR=${CMake_BINARY_DIR}" + "-DCMake_TEST_FindPython_NumPy=${CMake_TEST_FindPython_NumPy}" + "-DPython3_ARTIFACTS_INTERACTIVE=OFF" + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + add_test(NAME FindPython.CustomFailureMessage COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --build-and-test diff --git a/Tests/FindPython/Python3/CMakeLists.txt b/Tests/FindPython/Python3/CMakeLists.txt index 6691a48..34ebd2c 100644 --- a/Tests/FindPython/Python3/CMakeLists.txt +++ b/Tests/FindPython/Python3/CMakeLists.txt @@ -15,14 +15,14 @@ if (NOT Python3_FOUND) endif() if(NOT TARGET Python3::Interpreter) - message(SEND_ERROR "Python2::Interpreter not found") + message(SEND_ERROR "Python3::Interpreter not found") endif() if(NOT TARGET Python3::Python) - message(SEND_ERROR "Python2::Python not found") + message(SEND_ERROR "Python3::Python not found") endif() if(NOT TARGET Python3::Module) - message(SEND_ERROR "Python2::Module not found") + message(SEND_ERROR "Python3::Module not found") endif() Python3_add_library (spam3 MODULE ../spam.c) diff --git a/Tests/FindPython/SOABI/CMakeLists.txt b/Tests/FindPython/SOABI/CMakeLists.txt index aea2baf..4a6aea3 100644 --- a/Tests/FindPython/SOABI/CMakeLists.txt +++ b/Tests/FindPython/SOABI/CMakeLists.txt @@ -10,3 +10,13 @@ endif() if(NOT DEFINED Python3_SOABI) message(FATAL_ERROR "Python3_SOABI for ${CMake_TEST_FindPython_COMPONENT} not found") endif() + +if (Python3_Development_FOUND AND Python3_SOABI) + Python3_add_library (spam3 MODULE WITH_SOABI ../spam.c) + target_compile_definitions (spam3 PRIVATE PYTHON3) + + get_property (suffix TARGET spam3 PROPERTY SUFFIX) + if (NOT suffix MATCHES "^.${Python3_SOABI}") + message(FATAL_ERROR "Module suffix do not include Python3_SOABI") + endif() +endif() diff --git a/Tests/FindX11/Test/CMakeLists.txt b/Tests/FindX11/Test/CMakeLists.txt index 769271f..b2adfb2 100644 --- a/Tests/FindX11/Test/CMakeLists.txt +++ b/Tests/FindX11/Test/CMakeLists.txt @@ -29,6 +29,10 @@ test_x11_component(x11_components SM) set(X11_X11_FOUND ${X11_FOUND}) test_x11_component(x11_components X11) test_x11_component(x11_components Xau) +test_x11_component(x11_components xcb) +test_x11_component(x11_components X11_xcb) +test_x11_component(x11_components xcb_icccm) +test_x11_component(x11_components xcb_xkb) test_x11_component(x11_components Xcomposite) test_x11_component(x11_components Xdamage) test_x11_component(x11_components Xdmcp) @@ -41,6 +45,8 @@ test_x11_component(x11_components Xfixes) test_x11_component(x11_components_ignore Xft) test_x11_component(x11_components Xi) test_x11_component(x11_components Xinerama) +test_x11_component(x11_components xkbcommon) +test_x11_component(x11_components xkbcommon_X11) test_x11_component(x11_components Xkb) test_x11_component(x11_components xkbfile) test_x11_component(x11_components Xmu) @@ -61,6 +67,9 @@ target_link_libraries(test_var PRIVATE ${X11_LIBRARIES}) # Not included in X11_LIBRARIES. foreach(lib Xau + xcb + X11_xcb + xcb_icccm Xcomposite Xdamage Xdmcp @@ -69,6 +78,8 @@ foreach(lib Xfixes Xi Xinerama + xkbcommon + xkbcommon_X11 Xkb xkbfile Xmu diff --git a/Tests/ObjectLibrary/CMakeLists.txt b/Tests/ObjectLibrary/CMakeLists.txt index 7897ab9..fca5f41 100644 --- a/Tests/ObjectLibrary/CMakeLists.txt +++ b/Tests/ObjectLibrary/CMakeLists.txt @@ -73,3 +73,5 @@ add_executable(UseABstaticObjs $<TARGET_OBJECTS:UseABstatic>) target_link_libraries(UseABstaticObjs ABstatic) add_subdirectory(ExportLanguages) + +add_subdirectory(Transitive) diff --git a/Tests/ObjectLibrary/Transitive/CMakeLists.txt b/Tests/ObjectLibrary/Transitive/CMakeLists.txt new file mode 100644 index 0000000..d616cda --- /dev/null +++ b/Tests/ObjectLibrary/Transitive/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_policy(SET CMP0022 NEW) +add_library(FooStatic STATIC FooStatic.c) + +add_library(FooObject1 OBJECT FooObject.c) +target_link_libraries(FooObject1 PRIVATE FooStatic) +add_executable(Transitive1 Transitive.c) +target_link_libraries(Transitive1 PRIVATE FooObject1) + +add_library(FooObject2 OBJECT FooObject.c) +target_link_libraries(FooObject2 INTERFACE FooStatic) +add_executable(Transitive2 Transitive.c) +target_link_libraries(Transitive2 PRIVATE FooObject2) diff --git a/Tests/ObjectLibrary/Transitive/FooObject.c b/Tests/ObjectLibrary/Transitive/FooObject.c new file mode 100644 index 0000000..54c1f29 --- /dev/null +++ b/Tests/ObjectLibrary/Transitive/FooObject.c @@ -0,0 +1,4 @@ +int FooObject(void) +{ + return 0; +} diff --git a/Tests/ObjectLibrary/Transitive/FooStatic.c b/Tests/ObjectLibrary/Transitive/FooStatic.c new file mode 100644 index 0000000..84649c7 --- /dev/null +++ b/Tests/ObjectLibrary/Transitive/FooStatic.c @@ -0,0 +1,4 @@ +int FooStatic(void) +{ + return 0; +} diff --git a/Tests/ObjectLibrary/Transitive/Transitive.c b/Tests/ObjectLibrary/Transitive/Transitive.c new file mode 100644 index 0000000..43089b8 --- /dev/null +++ b/Tests/ObjectLibrary/Transitive/Transitive.c @@ -0,0 +1,7 @@ +extern int FooObject(void); +extern int FooStatic(void); + +int main(void) +{ + return FooObject() + FooStatic(); +} diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_exe.json index 91951c3..3c9ace3 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_exe.json @@ -131,7 +131,20 @@ "dependencies": [ { "id": "^c_object_lib::@5ed5358f70faf8d8af7a$", - "backtrace": null + "backtrace": [ + { + "file": "^object/CMakeLists\\.txt$", + "line": 7, + "command": "target_link_libraries", + "hasParent": true + }, + { + "file": "^object/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] }, { "id": "^ZERO_CHECK::@5ed5358f70faf8d8af7a$", diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_exe.json index a33370a..119c91d 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_exe.json @@ -131,7 +131,20 @@ "dependencies": [ { "id": "^cxx_object_lib::@5ed5358f70faf8d8af7a$", - "backtrace": null + "backtrace": [ + { + "file": "^object/CMakeLists\\.txt$", + "line": 11, + "command": "target_link_libraries", + "hasParent": true + }, + { + "file": "^object/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] }, { "id": "^ZERO_CHECK::@5ed5358f70faf8d8af7a$", diff --git a/Tests/RunCMake/Framework/FrameworkMultiConfigPostfix-build-final-check.cmake b/Tests/RunCMake/Framework/FrameworkMultiConfigPostfix-build-final-check.cmake new file mode 100644 index 0000000..76fe6b8 --- /dev/null +++ b/Tests/RunCMake/Framework/FrameworkMultiConfigPostfix-build-final-check.cmake @@ -0,0 +1,45 @@ +include("${RunCMake_TEST_BINARY_DIR}/FrameworkMultiConfigPostfixInfo.cmake") + +get_filename_component(framework_location "${framework_dir}" DIRECTORY) +set(non_existent_debug_framework_dir "${framework_location}/${target_file_name}_debug.framework") +set(framework_resources "${framework_dir}/Resources") +set(plist_file "${framework_resources}/Info.plist") + +set(symlink_release_path "${framework_dir}/${target_file_name}") +set(framework_release_path "${framework_dir}/Versions/A/${target_file_name}") + +# When using a multi config generator (like Ninja Multi-Config and Xcode), +# the postfix will be applied to the debug framework library name and the symlink name. +# For single config generators, the name stays the same as the the release framework. +if(is_multi_config) + set(symlink_debug_path "${framework_dir}/${target_file_name}_debug") + set(framework_debug_path "${framework_dir}/Versions/A/${target_file_name}_debug") +else() + set(symlink_debug_path "${framework_dir}/${target_file_name}") + set(framework_debug_path "${framework_dir}/Versions/A/${target_file_name}") +endif() + +if(NOT IS_DIRECTORY ${framework_dir}) + message(SEND_ERROR "Framework dir not found at ${framework_dir}") +endif() + +if(IS_DIRECTORY ${non_existent_debug_framework_dir}) + message(SEND_ERROR + "A framework dir with a debug suffix should not exist at ${non_existent_debug_framework_dir}") +endif() + +if(NOT IS_SYMLINK "${symlink_release_path}") + message(SEND_ERROR "Release framework symlink not found at ${symlink_release_path}") +endif() + +if(NOT IS_SYMLINK "${symlink_debug_path}") + message(SEND_ERROR "Debug framework symlink not found at ${symlink_debug_path}") +endif() + +if(NOT EXISTS "${framework_release_path}") + message(SEND_ERROR "Release framework not found at ${framework_release_path}") +endif() + +if(NOT EXISTS "${framework_debug_path}") + message(SEND_ERROR "Debug framework not found at ${framework_debug_path}") +endif() diff --git a/Tests/RunCMake/Framework/FrameworkMultiConfigPostfix.cmake b/Tests/RunCMake/Framework/FrameworkMultiConfigPostfix.cmake new file mode 100644 index 0000000..51e627d --- /dev/null +++ b/Tests/RunCMake/Framework/FrameworkMultiConfigPostfix.cmake @@ -0,0 +1,25 @@ +enable_language(C) + +set(CMAKE_FRAMEWORK_MULTI_CONFIG_POSTFIX_DEBUG "_debug") + +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_BINARY_DIR}/lib) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_BINARY_DIR}/lib) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_BINARY_DIR}/bin) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_BINARY_DIR}/bin) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_BINARY_DIR}/lib) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_BINARY_DIR}/lib) + +set(target_name "mylib") +add_library(${target_name} SHARED foo.c) +set_property(TARGET ${target_name} PROPERTY FRAMEWORK ON) +get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + +string(APPEND content + "set(is_multi_config \"${is_multi_config}\")\n" + "set(framework_dir \"$<TARGET_BUNDLE_DIR:${target_name}>\")\n" + "set(target_file_name ${target_name})\n") +file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/FrameworkMultiConfigPostfixInfo.cmake + CONTENT "${content}") diff --git a/Tests/RunCMake/Framework/RunCMakeTest.cmake b/Tests/RunCMake/Framework/RunCMakeTest.cmake index 965fbf4..6ee61a3 100644 --- a/Tests/RunCMake/Framework/RunCMakeTest.cmake +++ b/Tests/RunCMake/Framework/RunCMakeTest.cmake @@ -45,3 +45,39 @@ framework_type_test(ios SHARED YES) framework_type_test(ios STATIC YES) framework_type_test(osx SHARED YES) framework_type_test(osx STATIC YES) + +function(framework_multi_config_postfix_test) + set(configure_name "FrameworkMultiConfigPostfix") + set(build_name "${configure_name}-build-intermediate") + set(build_name_final "${configure_name}-build-final") + + if(RunCMake_GENERATOR MATCHES "Ninja Multi-Config") + set(RunCMake_TEST_OPTIONS + "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release;-DCMAKE_CROSS_CONFIGS=all") + elseif(RunCMake_GENERATOR MATCHES "Xcode") + set(RunCMake_TEST_OPTIONS + "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release") + else() + set(RunCMake_TEST_OPTIONS "-DCMAKE_BUILD_TYPE=Debug") + endif() + + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${configure_name}) + set(RunCMake_TEST_NO_CLEAN 1) + + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(${configure_name}) + unset(RunCMake_TEST_OPTIONS) + + if(RunCMake_GENERATOR MATCHES "Ninja Multi-Config") + run_cmake_command(${build_name_final} ${CMAKE_COMMAND} --build . --target all:all) + elseif(RunCMake_GENERATOR MATCHES "Xcode") + run_cmake_command(${build_name} ${CMAKE_COMMAND} --build . --config Release) + run_cmake_command(${build_name} ${CMAKE_COMMAND} --build . --config Debug) + run_cmake_command(${build_name_final} ${CMAKE_COMMAND} --build . --config Debug) + else() + run_cmake_command(${build_name_final} ${CMAKE_COMMAND} --build .) + endif() +endfunction() + +framework_multi_config_postfix_test() diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-in-release-graph-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-in-release-graph-build-check.cmake index f534319..167f5b9 100644 --- a/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-in-release-graph-build-check.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-in-release-graph-build-check.cmake @@ -23,12 +23,11 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_OBJECT_FILES_generatorobj_Release} - ${TARGET_OBJECT_FILES_emptyobj_Release} - EXCLUDE ${TARGET_OBJECT_FILES_generator_Debug} ${TARGET_OBJECT_FILES_generated_Release} + ${TARGET_OBJECT_FILES_emptyobj_Release} ${TARGET_OBJECT_FILES_generator_MinSizeRel} ${TARGET_OBJECT_FILES_generated_MinSizeRel} diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-in-release-graph-clean-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-in-release-graph-clean-ninja-check.cmake index 5e30bfe..1e4cbe1 100644 --- a/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-in-release-graph-clean-ninja-check.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-debug-in-release-graph-clean-ninja-check.cmake @@ -11,8 +11,6 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_OBJECT_FILES_generatorobj_Release} - ${TARGET_OBJECT_FILES_emptyobj_Release} - EXCLUDE ${TARGET_OBJECT_FILES_generator_Debug} ${TARGET_OBJECT_FILES_generated_Debug} @@ -21,6 +19,7 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_OBJECT_FILES_emptyobj_Debug} ${TARGET_OBJECT_FILES_generated_Release} + ${TARGET_OBJECT_FILES_emptyobj_Release} ${TARGET_OBJECT_FILES_generator_MinSizeRel} ${TARGET_OBJECT_FILES_generated_MinSizeRel} diff --git a/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-release-in-debug-graph-ninja-check.cmake b/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-release-in-debug-graph-ninja-check.cmake index 9500cda..faf392e 100644 --- a/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-release-in-debug-graph-ninja-check.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/CustomCommandGenerator-release-in-debug-graph-ninja-check.cmake @@ -12,8 +12,6 @@ check_files("${RunCMake_TEST_BINARY_DIR}" ${TARGET_OBJECT_FILES_generatorobj_Debug} - ${TARGET_OBJECT_FILES_emptyobj_Debug} - ${TARGET_FILE_generator_Release} ${TARGET_OBJECT_FILES_generator_Release} @@ -30,6 +28,7 @@ check_files("${RunCMake_TEST_BINARY_DIR}" EXCLUDE ${TARGET_OBJECT_FILES_generated_Debug} + ${TARGET_OBJECT_FILES_emptyobj_Debug} ${TARGET_OBJECT_FILES_generator_MinSizeRel} ${TARGET_OBJECT_FILES_generated_MinSizeRel} diff --git a/Tests/RunCMake/NinjaMultiConfig/NoUnusedVariables.cmake b/Tests/RunCMake/NinjaMultiConfig/NoUnusedVariables.cmake new file mode 100644 index 0000000..bb7b160 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/NoUnusedVariables.cmake @@ -0,0 +1 @@ +# Intentionally empty diff --git a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake index b07b4f7..6472f46 100644 --- a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake @@ -78,8 +78,6 @@ endfunction() ############################################################################### -set(RunCMake_TEST_NO_CLEAN 1) - set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Simple-build) # IMPORTANT: Setting RelWithDebInfo as the first item in CMAKE_CONFIGURATION_TYPES # generates a build.ninja file with that configuration @@ -203,6 +201,7 @@ unset(RunCMake_TEST_OPTIONS) include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) run_cmake_build(FrameworkDependencyAutogen framework Release test2:Debug) +set(RunCMake_TEST_NO_CLEAN 1) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CustomCommandGenerator-build) set(RunCMake_TEST_OPTIONS "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release\\;MinSizeRel\\;RelWithDebInfo;-DCMAKE_CROSS_CONFIGS=all") run_cmake_configure(CustomCommandGenerator) @@ -219,6 +218,7 @@ run_cmake_command(CustomCommandGenerator-debug-in-release-graph-generated "${TAR run_ninja(CustomCommandGenerator debug-in-release-graph-clean build-Debug.ninja clean:Debug) run_ninja(CustomCommandGenerator release-in-debug-graph build-Debug.ninja generated:Release) run_cmake_command(CustomCommandGenerator-release-in-debug-graph-generated "${TARGET_FILE_generated_Release}") +unset(RunCMake_TEST_NO_CLEAN) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CustomCommandsAndTargets-build) set(RunCMake_TEST_OPTIONS "-DCMAKE_CROSS_CONFIGS=all") @@ -275,6 +275,16 @@ run_ninja(Install debug-in-release-graph-install build-Release.ninja install:Deb #run_cmake_configure(AutoMocExecutable) #run_cmake_build(AutoMocExecutable debug-in-release-graph Release exe) +# Need to test this manually because run_cmake() adds --no-warn-unused-cli +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/NoUnusedVariables-build) +run_cmake_command(NoUnusedVariables ${CMAKE_COMMAND} ${CMAKE_CURRENT_LIST_DIR} + -G "Ninja Multi-Config" + "-DRunCMake_TEST=NoUnusedVariables" + "-DCMAKE_CROSS_CONFIGS=all" + "-DCMAKE_DEFAULT_BUILD_TYPE=Debug" + "-DCMAKE_DEFAULT_CONFIGS=all" + ) + if(CMake_TEST_CUDA) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CudaSimple-build) run_cmake_configure(CudaSimple) diff --git a/Tests/RunCMake/Syntax/CommandEOF-stderr.txt b/Tests/RunCMake/Syntax/CommandEOF-stderr.txt index 31cbc08..b9f8fd1 100644 --- a/Tests/RunCMake/Syntax/CommandEOF-stderr.txt +++ b/Tests/RunCMake/Syntax/CommandEOF-stderr.txt @@ -1,4 +1,4 @@ -^CMake Error in CommandEOF.cmake: +^CMake Error at CommandEOF.cmake:1: Unexpected end of file. Parse error. Function missing opening "\(". diff --git a/Tests/RunCMake/cmake_command/RunCMakeTest.cmake b/Tests/RunCMake/cmake_command/RunCMakeTest.cmake index d338cd8..2b6e7a2 100644 --- a/Tests/RunCMake/cmake_command/RunCMakeTest.cmake +++ b/Tests/RunCMake/cmake_command/RunCMakeTest.cmake @@ -6,3 +6,8 @@ run_cmake(cmake_command_invoke_message) run_cmake(cmake_command_invoke_message_fatal_error) run_cmake(cmake_command_invoke_no_parameters) run_cmake(cmake_command_invoke_unknown_function) +run_cmake(cmake_command_eval_message) +run_cmake(cmake_command_eval_message_fatal_error) +run_cmake(cmake_command_eval_no_code) +run_cmake(cmake_command_eval_no_parameters) +run_cmake(cmake_command_eval_variable_outside_message) diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_message-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_eval_message-stderr.txt new file mode 100644 index 0000000..cfc8694 --- /dev/null +++ b/Tests/RunCMake/cmake_command/cmake_command_eval_message-stderr.txt @@ -0,0 +1 @@ +WORKS! diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_message.cmake b/Tests/RunCMake/cmake_command/cmake_command_eval_message.cmake new file mode 100644 index 0000000..9ef5e25 --- /dev/null +++ b/Tests/RunCMake/cmake_command/cmake_command_eval_message.cmake @@ -0,0 +1 @@ +cmake_command(EVAL CODE message(WORKS!)) diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_message_fatal_error-result.txt b/Tests/RunCMake/cmake_command/cmake_command_eval_message_fatal_error-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_command/cmake_command_eval_message_fatal_error-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_message_fatal_error-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_eval_message_fatal_error-stderr.txt new file mode 100644 index 0000000..6a8a124 --- /dev/null +++ b/Tests/RunCMake/cmake_command/cmake_command_eval_message_fatal_error-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at cmake_command_eval_message_fatal_error.cmake:1:EVAL:2 \(message\): + error! +Call Stack \(most recent call first\): + cmake_command_eval_message_fatal_error.cmake:1 \(cmake_command\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_message_fatal_error.cmake b/Tests/RunCMake/cmake_command/cmake_command_eval_message_fatal_error.cmake new file mode 100644 index 0000000..22913de --- /dev/null +++ b/Tests/RunCMake/cmake_command/cmake_command_eval_message_fatal_error.cmake @@ -0,0 +1,5 @@ +cmake_command(EVAL CODE +" + message(FATAL_ERROR error!) +" +) diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_no_code-result.txt b/Tests/RunCMake/cmake_command/cmake_command_eval_no_code-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_command/cmake_command_eval_no_code-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_no_code-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_eval_no_code-stderr.txt new file mode 100644 index 0000000..ee53312 --- /dev/null +++ b/Tests/RunCMake/cmake_command/cmake_command_eval_no_code-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at cmake_command_eval_no_code.cmake:1 \(cmake_command\): + cmake_command called without CODE argument diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_no_code.cmake b/Tests/RunCMake/cmake_command/cmake_command_eval_no_code.cmake new file mode 100644 index 0000000..22e1667 --- /dev/null +++ b/Tests/RunCMake/cmake_command/cmake_command_eval_no_code.cmake @@ -0,0 +1 @@ +cmake_command(EVAL message "too many parameters") diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_no_parameters-result.txt b/Tests/RunCMake/cmake_command/cmake_command_eval_no_parameters-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_command/cmake_command_eval_no_parameters-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_no_parameters-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_eval_no_parameters-stderr.txt new file mode 100644 index 0000000..e9fc317 --- /dev/null +++ b/Tests/RunCMake/cmake_command/cmake_command_eval_no_parameters-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at cmake_command_eval_no_parameters.cmake:1 \(cmake_command\): + cmake_command called with incorrect number of arguments diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_no_parameters.cmake b/Tests/RunCMake/cmake_command/cmake_command_eval_no_parameters.cmake new file mode 100644 index 0000000..a5ba2c7 --- /dev/null +++ b/Tests/RunCMake/cmake_command/cmake_command_eval_no_parameters.cmake @@ -0,0 +1 @@ +cmake_command(EVAL) diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_variable_outside_message-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_eval_variable_outside_message-stderr.txt new file mode 100644 index 0000000..cfc8694 --- /dev/null +++ b/Tests/RunCMake/cmake_command/cmake_command_eval_variable_outside_message-stderr.txt @@ -0,0 +1 @@ +WORKS! diff --git a/Tests/RunCMake/cmake_command/cmake_command_eval_variable_outside_message.cmake b/Tests/RunCMake/cmake_command/cmake_command_eval_variable_outside_message.cmake new file mode 100644 index 0000000..b7a06a5 --- /dev/null +++ b/Tests/RunCMake/cmake_command/cmake_command_eval_variable_outside_message.cmake @@ -0,0 +1,2 @@ +cmake_command(EVAL CODE "set(phrase \"WORKS!\")") +message(${phrase}) |