diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-10-08 09:13:39 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-10-08 09:13:39 +0900 |
commit | 5e0b8c3fb67987a77056099c684318ef5d707920 (patch) | |
tree | c3a3b53d4d61c2c94f609ee26a71671a484ea32d /Tests | |
parent | c63a2296411acf2bed956eda98a60e612a2fc94e (diff) | |
download | cmake-5e0b8c3fb67987a77056099c684318ef5d707920.tar.gz cmake-5e0b8c3fb67987a77056099c684318ef5d707920.tar.bz2 cmake-5e0b8c3fb67987a77056099c684318ef5d707920.zip |
Imported Upstream version 3.13.4upstream/3.13.4
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/Autogen/QtInFunction.cmake | 13 | ||||
-rw-r--r-- | Tests/RunCMake/Autogen/QtInFunctionNested-stderr.txt | 8 | ||||
-rw-r--r-- | Tests/RunCMake/Autogen/QtInFunctionNested.cmake | 17 | ||||
-rw-r--r-- | Tests/RunCMake/Autogen/QtInFunctionProperty.cmake | 21 | ||||
-rw-r--r-- | Tests/RunCMake/Autogen/RunCMakeTest.cmake | 5 | ||||
-rw-r--r-- | Tests/RunCMake/CMakeLists.txt | 9 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 12 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/no-S-B-result.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/no-S-B-stderr.txt | 5 | ||||
-rw-r--r-- | Tests/RunCMake/Framework/InstallBeforeFramework.cmake | 5 | ||||
-rw-r--r-- | Tests/RunCMake/Framework/RunCMakeTest.cmake | 2 |
11 files changed, 94 insertions, 4 deletions
diff --git a/Tests/RunCMake/Autogen/QtInFunction.cmake b/Tests/RunCMake/Autogen/QtInFunction.cmake new file mode 100644 index 000000000..a44bc5ab4 --- /dev/null +++ b/Tests/RunCMake/Autogen/QtInFunction.cmake @@ -0,0 +1,13 @@ +enable_language(CXX) + +function (use_autogen target) + find_package(Qt5 REQUIRED COMPONENTS Core Widgets) + set(Qt5Core_VERSION_MAJOR "${Qt5Core_VERSION_MAJOR}" PARENT_SCOPE) + set(Qt5Core_VERSION_MINOR "${Qt5Core_VERSION_MINOR}" PARENT_SCOPE) + set_property(TARGET "${target}" PROPERTY AUTOMOC 1) + set_property(TARGET "${target}" PROPERTY AUTORCC 1) + set_property(TARGET "${target}" PROPERTY AUTOUIC 1) +endfunction () + +add_executable(main empty.cpp) +use_autogen(main) diff --git a/Tests/RunCMake/Autogen/QtInFunctionNested-stderr.txt b/Tests/RunCMake/Autogen/QtInFunctionNested-stderr.txt new file mode 100644 index 000000000..6b4a933f4 --- /dev/null +++ b/Tests/RunCMake/Autogen/QtInFunctionNested-stderr.txt @@ -0,0 +1,8 @@ +^CMake Warning \(dev\) in CMakeLists.txt: + AUTOGEN: No valid Qt version found for target main. AUTOMOC, AUTOUIC, + AUTORCC disabled. Consider adding: + + find_package\(Qt5 COMPONENTS Widgets\) + + to your CMakeLists.txt file. +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/Autogen/QtInFunctionNested.cmake b/Tests/RunCMake/Autogen/QtInFunctionNested.cmake new file mode 100644 index 000000000..5421ba00d --- /dev/null +++ b/Tests/RunCMake/Autogen/QtInFunctionNested.cmake @@ -0,0 +1,17 @@ +enable_language(CXX) + +function (use_autogen target) + find_package(Qt5 REQUIRED COMPONENTS Core Widgets) + set(Qt5Core_VERSION_MAJOR "${Qt5Core_VERSION_MAJOR}" PARENT_SCOPE) + set(Qt5Core_VERSION_MINOR "${Qt5Core_VERSION_MINOR}" PARENT_SCOPE) + set_property(TARGET "${target}" PROPERTY AUTOMOC 1) + set_property(TARGET "${target}" PROPERTY AUTORCC 1) + set_property(TARGET "${target}" PROPERTY AUTOUIC 1) +endfunction () + +function (wrap_autogen target) + use_autogen("${target}") +endfunction () + +add_executable(main empty.cpp) +wrap_autogen(main) diff --git a/Tests/RunCMake/Autogen/QtInFunctionProperty.cmake b/Tests/RunCMake/Autogen/QtInFunctionProperty.cmake new file mode 100644 index 000000000..35f1cd16c --- /dev/null +++ b/Tests/RunCMake/Autogen/QtInFunctionProperty.cmake @@ -0,0 +1,21 @@ +enable_language(CXX) + +function (use_autogen target) + find_package(Qt5 REQUIRED COMPONENTS Core Widgets) + set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + PROPERTY + Qt5Core_VERSION_MAJOR "${Qt5Core_VERSION_MAJOR}") + set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + PROPERTY + Qt5Core_VERSION_MINOR "${Qt5Core_VERSION_MINOR}") + set_property(TARGET "${target}" PROPERTY AUTOMOC 1) + set_property(TARGET "${target}" PROPERTY AUTORCC 1) + set_property(TARGET "${target}" PROPERTY AUTOUIC 1) +endfunction () + +function (wrap_autogen target) + use_autogen("${target}") +endfunction () + +add_executable(main empty.cpp) +wrap_autogen(main) diff --git a/Tests/RunCMake/Autogen/RunCMakeTest.cmake b/Tests/RunCMake/Autogen/RunCMakeTest.cmake index e52f28d25..a31b67cd7 100644 --- a/Tests/RunCMake/Autogen/RunCMakeTest.cmake +++ b/Tests/RunCMake/Autogen/RunCMakeTest.cmake @@ -1,3 +1,8 @@ include(RunCMake) run_cmake(NoQt) +if (with_qt5) + run_cmake(QtInFunction) + run_cmake(QtInFunctionNested) + run_cmake(QtInFunctionProperty) +endif () diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 89102dd39..27413dde1 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -142,7 +142,14 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE) endif() add_RunCMake_test(AndroidTestUtilities) -add_RunCMake_test(Autogen) +set(autogen_with_qt5 FALSE) +if(CMake_TEST_Qt5) + find_package(Qt5Widgets QUIET NO_MODULE) +endif() +if(CMake_TEST_Qt5 AND Qt5Widgets_FOUND) + set(autogen_with_qt5 TRUE) +endif () +add_RunCMake_test(Autogen -Dwith_qt5=${autogen_with_qt5}) add_RunCMake_test(BuildDepends) if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja") add_RunCMake_test(Byproducts) diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 32e20aca1..3e56c2554 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -54,12 +54,22 @@ run_cmake_command(cache-empty-entry ${CMAKE_COMMAND} --build ${RunCMake_SOURCE_DIR}/cache-empty-entry/) function(run_ExplicitDirs) + set(source_dir ${RunCMake_BINARY_DIR}/ExplicitDirsMissing) + + file(REMOVE_RECURSE "${source_dir}") + file(MAKE_DIRECTORY "${source_dir}") + file(WRITE ${source_dir}/CMakeLists.txt [=[ +cmake_minimum_required(VERSION 3.13) +project(ExplicitDirsMissing LANGUAGES NONE) +]=]) + run_cmake_command(no-S-B ${CMAKE_COMMAND} -E chdir ${source_dir} + ${CMAKE_COMMAND} -DFOO=BAR) + set(source_dir ${RunCMake_SOURCE_DIR}/ExplicitDirs) set(binary_dir ${RunCMake_BINARY_DIR}/ExplicitDirs-build) file(REMOVE_RECURSE "${binary_dir}") file(MAKE_DIRECTORY "${binary_dir}") - run_cmake_command(no-S-B ${CMAKE_COMMAND} -DFOO=BAR) run_cmake_command(S-arg ${CMAKE_COMMAND} -S ${source_dir} ${binary_dir}) run_cmake_command(S-arg-reverse-order ${CMAKE_COMMAND} ${binary_dir} -S${source_dir} ) run_cmake_command(S-no-arg ${CMAKE_COMMAND} -S ) diff --git a/Tests/RunCMake/CommandLine/no-S-B-result.txt b/Tests/RunCMake/CommandLine/no-S-B-result.txt deleted file mode 100644 index d00491fd7..000000000 --- a/Tests/RunCMake/CommandLine/no-S-B-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/CommandLine/no-S-B-stderr.txt b/Tests/RunCMake/CommandLine/no-S-B-stderr.txt index 7a943077b..c166dcf56 100644 --- a/Tests/RunCMake/CommandLine/no-S-B-stderr.txt +++ b/Tests/RunCMake/CommandLine/no-S-B-stderr.txt @@ -1 +1,4 @@ -CMake Error: No source or binary directory provided +CMake Warning: + No source or binary directory provided. Both will be assumed to be the + same as the current working directory, but note that this warning will + become a fatal error in future CMake releases. diff --git a/Tests/RunCMake/Framework/InstallBeforeFramework.cmake b/Tests/RunCMake/Framework/InstallBeforeFramework.cmake new file mode 100644 index 000000000..3791dace7 --- /dev/null +++ b/Tests/RunCMake/Framework/InstallBeforeFramework.cmake @@ -0,0 +1,5 @@ +enable_language(C) + +add_library(foo SHARED foo.c) +install(TARGETS foo LIBRARY DESTINATION lib) +set_property(TARGET foo PROPERTY FRAMEWORK TRUE) diff --git a/Tests/RunCMake/Framework/RunCMakeTest.cmake b/Tests/RunCMake/Framework/RunCMakeTest.cmake index 4fc83f801..e705a31fa 100644 --- a/Tests/RunCMake/Framework/RunCMakeTest.cmake +++ b/Tests/RunCMake/Framework/RunCMakeTest.cmake @@ -1,5 +1,7 @@ include(RunCMake) +run_cmake(InstallBeforeFramework) + function(framework_layout_test Name Toolchain Type) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${Toolchain}${Type}FrameworkLayout-build) set(RunCMake_TEST_NO_CLEAN 1) |