summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CPackComponentsDEB/RunCPackVerifyResult-components-depend1.cmake2
-rw-r--r--Tests/CPackComponentsDEB/RunCPackVerifyResult-components-depend2.cmake2
-rw-r--r--Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description1.cmake2
-rw-r--r--Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description2.cmake2
-rw-r--r--Tests/CPackComponentsDEB/RunCPackVerifyResult-components-lintian-dpkgdeb-checks.cmake2
-rw-r--r--Tests/CPackComponentsDEB/RunCPackVerifyResult-components-shlibdeps1.cmake2
-rw-r--r--Tests/CPackComponentsDEB/RunCPackVerifyResult-components-source.cmake2
-rw-r--r--Tests/CPackComponentsDEB/RunCPackVerifyResult-compression.cmake2
-rw-r--r--Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake2
-rw-r--r--Tests/CudaOnly/WithDefs/CMakeLists.txt6
-rw-r--r--Tests/FindOpenGL/CMakeLists.txt7
-rw-r--r--Tests/FindOpenGL/Test/CMakeLists.txt58
-rw-r--r--Tests/QtAutogen/CMakeLists.txt19
-rw-r--r--Tests/QtAutogen/mocMacroName/CMakeLists.txt8
-rw-r--r--Tests/QtAutogen/mocMacroName/CustomMacros.hpp8
-rw-r--r--Tests/QtAutogen/mocMacroName/Gadget.cpp6
-rw-r--r--Tests/QtAutogen/mocMacroName/Gadget.hpp15
-rw-r--r--Tests/QtAutogen/mocMacroName/MacroAlias.hpp7
-rw-r--r--Tests/QtAutogen/mocMacroName/MacroName.cpp9
-rw-r--r--Tests/QtAutogen/mocMacroName/MacroName.hpp20
-rw-r--r--Tests/QtAutogen/mocMacroName/Object.cpp9
-rw-r--r--Tests/QtAutogen/mocMacroName/Object.hpp19
-rw-r--r--Tests/QtAutogen/mocMacroName/Object1Aliased.cpp9
-rw-r--r--Tests/QtAutogen/mocMacroName/Object1Aliased.hpp20
-rw-r--r--Tests/QtAutogen/mocMacroName/Object2Aliased.cpp9
-rw-r--r--Tests/QtAutogen/mocMacroName/Object2Aliased.hpp20
-rw-r--r--Tests/QtAutogen/mocMacroName/main.cpp10
-rw-r--r--Tests/QtAutogen/sameName/CMakeLists.txt5
-rw-r--r--Tests/QtAutogen/sameName/aaa/bbb/item.cpp12
-rw-r--r--Tests/QtAutogen/sameName/aaa/item.cpp14
-rw-r--r--Tests/QtAutogen/sameName/aaa/item.hpp2
-rw-r--r--Tests/QtAutogen/sameName/aaa/view.ui24
-rw-r--r--Tests/QtAutogen/sameName/bbb/aaa/item.cpp12
-rw-r--r--Tests/QtAutogen/sameName/bbb/item.cpp15
-rw-r--r--Tests/QtAutogen/sameName/bbb/item.hpp1
-rw-r--r--Tests/QtAutogen/sameName/bbb/view.ui24
-rw-r--r--Tests/QtAutogen/sameName/ccc/item.cpp20
-rw-r--r--Tests/QtAutogen/sameName/ccc/item.hpp2
-rw-r--r--Tests/QtAutogen/sameName/ccc/view.ui24
-rw-r--r--Tests/QtAutogen/sameName/item.cpp15
-rw-r--r--Tests/QtAutogen/sameName/item.hpp2
-rw-r--r--Tests/QtAutogen/sameName/view.ui24
-rw-r--r--Tests/QtAutogenRerun/CMakeLists.txt199
-rw-r--r--Tests/QtAutogenRerun/mocPlugin.cmake96
-rw-r--r--Tests/QtAutogenRerun/mocPlugin/CMakeLists.txt4
-rw-r--r--Tests/QtAutogenRerun/mocPlugin/StyleA.hpp4
-rw-r--r--Tests/QtAutogenRerun/mocPlugin/StyleB.hpp4
-rw-r--r--Tests/QtAutogenRerun/mocPlugin/StyleC.hpp2
-rw-r--r--Tests/QtAutogenRerun/mocPlugin/StyleD.hpp2
-rw-r--r--Tests/QtAutogenRerun/mocPlugin/StyleE.cpp3
-rw-r--r--Tests/QtAutogenRerun/mocPlugin/StyleE.hpp17
-rw-r--r--Tests/QtAutogenRerun/mocPlugin/StyleEInclude.hpp17
-rw-r--r--Tests/QtAutogenRerun/mocPlugin/UtilityMacros.hpp (renamed from Tests/QtAutogenRerun/mocPlugin/StyleCommon.hpp)4
-rw-r--r--Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleB.json2
-rw-r--r--Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleE.json1
-rw-r--r--Tests/QtAutogenRerun/mocRerun.cmake60
-rw-r--r--Tests/QtAutogenRerun/mocRerun/CMakeLists.txt10
-rw-r--r--Tests/QtAutogenRerun/rccDepends.cmake131
-rw-r--r--Tests/QtAutogenRerun/rccDepends/CMakeLists.txt44
-rw-r--r--Tests/QtAutogenRerun/rccDepends/res/input1.txt.in1
-rw-r--r--Tests/QtAutogenRerun/rccDepends/res/input2.txt.in1
-rw-r--r--Tests/QtAutogenRerun/rccDepends/res1a.qrc.in5
-rw-r--r--Tests/QtAutogenRerun/rccDepends/res1b.qrc.in6
-rw-r--r--Tests/QtAutogenRerun/rccDepends/res2a.qrc.in5
-rw-r--r--Tests/QtAutogenRerun/rccDepends/res2b.qrc.in6
-rw-r--r--Tests/QtAutogenRerun/rccDepends/resGen/input.txt.in1
-rw-r--r--Tests/QtAutogenRerun/rccDepends/resGen/inputAdded.txt.in1
-rw-r--r--Tests/QtAutogenRerun/rccDepends/resGenA.qrc.in5
-rw-r--r--Tests/QtAutogenRerun/rccDepends/resGenB.qrc.in6
-rw-r--r--Tests/QtAutogenRerun/rccDepends/resPlain/input.txt.in1
-rw-r--r--Tests/QtAutogenRerun/rccDepends/resPlain/inputAdded.txt.in1
-rw-r--r--Tests/QtAutogenRerun/rccDepends/resPlainA.qrc.in5
-rw-r--r--Tests/QtAutogenRerun/rccDepends/resPlainB.qrc.in6
-rw-r--r--Tests/RunCMake/CMakeLists.txt46
-rw-r--r--Tests/RunCMake/CPack/DEB/Helpers.cmake2
-rw-r--r--Tests/RunCMake/CPack/RPM/Helpers.cmake3
-rw-r--r--Tests/RunCMake/CPack/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/CPack/VerifyResult.cmake4
-rw-r--r--Tests/RunCMake/CPack/tests/VERSION/ExpectedFiles.cmake3
-rw-r--r--Tests/RunCMake/CPack/tests/VERSION/VerifyResult.cmake17
-rw-r--r--Tests/RunCMake/CPack/tests/VERSION/test.cmake14
-rw-r--r--Tests/RunCMake/FindBoost/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/FindBoost/CMakePackage-stdout.txt3
-rw-r--r--Tests/RunCMake/FindBoost/CMakePackage.cmake2
-rw-r--r--Tests/RunCMake/FindBoost/CMakePackage/BoostConfig.cmake0
-rw-r--r--Tests/RunCMake/FindBoost/CMakePackage/BoostConfigVersion.cmake7
-rw-r--r--Tests/RunCMake/FindBoost/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/GetPrerequisites/TargetMissing-stderr.txt3
-rw-r--r--Tests/RunCMake/GetPrerequisites/TargetMissing.cmake4
-rw-r--r--Tests/RunCMake/get_property/source_properties-stderr.txt8
-rw-r--r--Tests/RunCMake/get_property/source_properties.cmake10
-rw-r--r--Tests/RunCMake/variable_watch/ModifyWatchInCallback.cmake17
-rw-r--r--Tests/RunCMake/variable_watch/RunCMakeTest.cmake1
-rw-r--r--Tests/VSResource/CMakeLists.txt7
-rw-r--r--Tests/VSWinStorePhone/CMakeLists.txt6
96 files changed, 936 insertions, 354 deletions
diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-depend1.cmake b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-depend1.cmake
index 70d6edf..73fd0ab 100644
--- a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-depend1.cmake
+++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-depend1.cmake
@@ -6,7 +6,7 @@ include(${CPackComponentsDEB_SOURCE_DIR}/RunCPackVerifyResult.cmake)
# expected results
-set(expected_file_mask "${CPackComponentsDEB_BINARY_DIR}/mylib-*_1.0.2-1_*.deb")
+set(expected_file_mask "${CPackComponentsDEB_BINARY_DIR}/mylib-*_1.0.2_*.deb")
set(expected_count 3)
diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-depend2.cmake b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-depend2.cmake
index 415d536..81dbbc5 100644
--- a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-depend2.cmake
+++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-depend2.cmake
@@ -6,7 +6,7 @@ include(${CPackComponentsDEB_SOURCE_DIR}/RunCPackVerifyResult.cmake)
# expected results
-set(expected_file_mask "${CPackComponentsDEB_BINARY_DIR}/mylib-*_1.0.2-1_*.deb")
+set(expected_file_mask "${CPackComponentsDEB_BINARY_DIR}/mylib-*_1.0.2_*.deb")
set(expected_count 3)
set(config_verbose -V)
diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description1.cmake b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description1.cmake
index 337cc16..ad52f56 100644
--- a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description1.cmake
+++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description1.cmake
@@ -6,7 +6,7 @@ include(${CPackComponentsDEB_SOURCE_DIR}/RunCPackVerifyResult.cmake)
# expected results
-set(expected_file_mask "${CPackComponentsDEB_BINARY_DIR}/mylib-*_1.0.2-1_*.deb")
+set(expected_file_mask "${CPackComponentsDEB_BINARY_DIR}/mylib-*_1.0.2_*.deb")
set(expected_count 3)
diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description2.cmake b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description2.cmake
index 35ca74c..af27c51 100644
--- a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description2.cmake
+++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description2.cmake
@@ -7,7 +7,7 @@ include(${CPackComponentsDEB_SOURCE_DIR}/RunCPackVerifyResult.cmake)
# expected results
-set(expected_file_mask "${CPackComponentsDEB_BINARY_DIR}/mylib-*_1.0.2-1_*.deb")
+set(expected_file_mask "${CPackComponentsDEB_BINARY_DIR}/mylib-*_1.0.2_*.deb")
set(expected_count 3)
diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-lintian-dpkgdeb-checks.cmake b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-lintian-dpkgdeb-checks.cmake
index f1391cd..1fe9258 100644
--- a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-lintian-dpkgdeb-checks.cmake
+++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-lintian-dpkgdeb-checks.cmake
@@ -5,7 +5,7 @@ endif()
include(${CPackComponentsDEB_SOURCE_DIR}/RunCPackVerifyResult.cmake)
# TODO: currently debian doens't produce lower cased names
-set(expected_file_mask "${CPackComponentsDEB_BINARY_DIR}/mylib-*_1.0.2-1_*.deb")
+set(expected_file_mask "${CPackComponentsDEB_BINARY_DIR}/mylib-*_1.0.2_*.deb")
set(expected_count 3)
diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-shlibdeps1.cmake b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-shlibdeps1.cmake
index fcfc7ea..e57488c 100644
--- a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-shlibdeps1.cmake
+++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-shlibdeps1.cmake
@@ -9,7 +9,7 @@ include(${CPackComponentsDEB_SOURCE_DIR}/RunCPackVerifyResult.cmake)
# requirements
# debian now produces lower case names
-set(expected_file_mask "${CPackComponentsDEB_BINARY_DIR}/mylib-*_1.0.2-1_*.deb")
+set(expected_file_mask "${CPackComponentsDEB_BINARY_DIR}/mylib-*_1.0.2_*.deb")
set(expected_count 3)
diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-source.cmake b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-source.cmake
index 351bf21..5ee057a 100644
--- a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-source.cmake
+++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-source.cmake
@@ -6,7 +6,7 @@ include(${CPackComponentsDEB_SOURCE_DIR}/RunCPackVerifyResult.cmake)
# expected results
-set(expected_file_mask "${CPackComponentsDEB_BINARY_DIR}/mylib-*_1.0.2-1_*.deb")
+set(expected_file_mask "${CPackComponentsDEB_BINARY_DIR}/mylib-*_1.0.2_*.deb")
set(expected_count 3)
set(config_verbose -V)
diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult-compression.cmake b/Tests/CPackComponentsDEB/RunCPackVerifyResult-compression.cmake
index c97ecb0..13a626a 100644
--- a/Tests/CPackComponentsDEB/RunCPackVerifyResult-compression.cmake
+++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult-compression.cmake
@@ -5,7 +5,7 @@ endif()
include(${CPackComponentsDEB_SOURCE_DIR}/RunCPackVerifyResult.cmake)
# TODO: currently debian doens't produce lower cased names
-set(expected_file_mask "${CPackComponentsDEB_BINARY_DIR}/mylib_1.0.2-1_*.deb")
+set(expected_file_mask "${CPackComponentsDEB_BINARY_DIR}/mylib_1.0.2_*.deb")
set(expected_count 1)
set(actual_output)
diff --git a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake
index a5b38fd..2c3a849 100644
--- a/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake
+++ b/Tests/CPackComponentsForAll/RunCPackVerifyResult.cmake
@@ -60,7 +60,7 @@ elseif (CPackGen MATCHES "RPM")
set(expected_count 1)
endif ()
elseif (CPackGen MATCHES "DEB")
- set(expected_file_mask "${CPackComponentsForAll_BINARY_DIR}/mylib*_1.0.2-1_*.deb")
+ set(expected_file_mask "${CPackComponentsForAll_BINARY_DIR}/mylib*_1.0.2_*.deb")
if (${CPackComponentWay} STREQUAL "default")
set(expected_count 1)
elseif (${CPackComponentWay} STREQUAL "OnePackPerGroup")
diff --git a/Tests/CudaOnly/WithDefs/CMakeLists.txt b/Tests/CudaOnly/WithDefs/CMakeLists.txt
index 0bc4e5c..9b82366 100644
--- a/Tests/CudaOnly/WithDefs/CMakeLists.txt
+++ b/Tests/CudaOnly/WithDefs/CMakeLists.txt
@@ -4,7 +4,11 @@ project (CudaOnlyWithDefs CUDA)
#verify that we can pass explicit cuda arch flags
string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30")
-set(debug_compile_flags --generate-code arch=compute_20,code=sm_20)
+if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 9)
+ set(debug_compile_flags --generate-code arch=compute_32,code=sm_32)
+else()
+ set(debug_compile_flags --generate-code arch=compute_20,code=sm_20)
+endif()
if(CMAKE_CUDA_SIMULATE_ID STREQUAL "MSVC")
list(APPEND debug_compile_flags -Xcompiler=-WX)
else()
diff --git a/Tests/FindOpenGL/CMakeLists.txt b/Tests/FindOpenGL/CMakeLists.txt
index 9aa3aba..97c9e60 100644
--- a/Tests/FindOpenGL/CMakeLists.txt
+++ b/Tests/FindOpenGL/CMakeLists.txt
@@ -1,3 +1,9 @@
+if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMake_TEST_FindOpenGL_VND)
+ set(_vnd_testing TRUE)
+else()
+ set(_vnd_testing FALSE)
+endif()
+
add_test(NAME FindOpenGL.Test COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
@@ -6,5 +12,6 @@ add_test(NAME FindOpenGL.Test COMMAND
${build_generator_args}
--build-project TestFindOpenGL
--build-options ${build_options}
+ -DOpenGL_TEST_VND=${_vnd_testing}
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
diff --git a/Tests/FindOpenGL/Test/CMakeLists.txt b/Tests/FindOpenGL/Test/CMakeLists.txt
index cac3424..3b5ffee 100644
--- a/Tests/FindOpenGL/Test/CMakeLists.txt
+++ b/Tests/FindOpenGL/Test/CMakeLists.txt
@@ -1,14 +1,70 @@
-cmake_minimum_required(VERSION 3.7)
+cmake_minimum_required(VERSION 3.9)
project(TestFindOpenGL C)
include(CTest)
find_package(OpenGL REQUIRED)
+# import target for GLU
add_executable(test_tgt main.c)
target_link_libraries(test_tgt OpenGL::GLU)
add_test(NAME test_tgt COMMAND test_tgt)
+# OPENGL_LIBRARIES should be whatever libraries are needed to link.
add_executable(test_var main.c)
target_include_directories(test_var PRIVATE ${OPENGL_INGLUDE_DIRS})
target_link_libraries(test_var PRIVATE ${OPENGL_LIBRARIES})
add_test(NAME test_var COMMAND test_var)
+
+# VND support adds an ::OpenGL import target. This can be used for OpenGL-only
+# code (code that does not manipulate contexts, like our 'main.c'). Without
+# VND, ::GL can be used for both context and non-context OpenGL code.
+if(OpenGL_TEST_VND)
+ add_executable(test_comp_none main.c)
+ target_link_libraries(test_comp_none PRIVATE OpenGL::OpenGL)
+ add_test(NAME test_comp_none COMMAND test_comp_none)
+else()
+ add_executable(test_comp_none main.c)
+ target_link_libraries(test_comp_none PRIVATE OpenGL::GL)
+ add_test(NAME test_comp_none COMMAND test_comp_none)
+endif()
+
+# GLX
+if(OpenGL_TEST_VND)
+ find_package(OpenGL REQUIRED COMPONENTS OpenGL GLX)
+ add_executable(test_comp_glx main.c)
+ target_link_libraries(test_comp_glx PRIVATE OpenGL::OpenGL OpenGL::GLX)
+ add_test(NAME test_comp_glx COMMAND test_comp_glx)
+else()
+ # non-VND systems won't have it, but an optional search for GLX should still
+ # be okay.
+ find_package(OpenGL COMPONENTS GLX)
+ add_executable(test_comp_glx_novnd main.c)
+ target_link_libraries(test_comp_glx_novnd PRIVATE OpenGL::GL)
+ add_test(NAME test_comp_glx_novnd COMMAND test_comp_glx_novnd)
+endif()
+
+# EGL is only available on Linux+GLVND at present.
+if(OpenGL_TEST_VND)
+ find_package(OpenGL COMPONENTS OpenGL EGL)
+ if(OpenGL_EGL_FOUND)
+ add_executable(test_comp_egl main.c)
+ target_link_libraries(test_comp_egl PRIVATE OpenGL::OpenGL OpenGL::EGL)
+ add_test(NAME test_comp_egl COMMAND test_comp_egl)
+ # EGL-only code should not link to GLX.
+ execute_process(COMMAND ldd test_comp_egl
+ OUTPUT_VARIABLE LDD_OUT
+ ERROR_VARIABLE LDD_ERR)
+ if("${LDD_OUT}" MATCHES "GLX")
+ message(FATAL_ERROR "EGL-only code links to GLX!")
+ endif()
+ endif()
+
+ # all three COMPONENTS together.
+ find_package(OpenGL COMPONENTS OpenGL EGL GLX)
+ if(OpenGL_EGL_FOUND AND OpenGL_GLX_FOUND)
+ add_executable(test_comp_both main.c)
+ target_link_libraries(test_comp_both PRIVATE OpenGL::OpenGL OpenGL::EGL
+ OpenGL::GLX)
+ add_test(NAME test_comp_both COMMAND test_comp_both)
+ endif()
+endif()
diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt
index 81ab734..ec35b89 100644
--- a/Tests/QtAutogen/CMakeLists.txt
+++ b/Tests/QtAutogen/CMakeLists.txt
@@ -66,15 +66,6 @@ set_property(TARGET mocOnly PROPERTY AUTOMOC ON)
target_link_libraries(mocOnly ${QT_LIBRARIES})
# -- Test
-# MOC AUTOMOC_MACRO_NAMES
-if (NOT QT_TEST_VERSION STREQUAL 4)
- add_executable(mocMacroName mocMacroName/main.cpp mocMacroName/MacroName.cpp)
- set_property(TARGET mocMacroName PROPERTY AUTOMOC ON)
- set_property(TARGET mocMacroName PROPERTY AUTOMOC_MACRO_NAMES "QO_ALIAS")
- target_link_libraries(mocMacroName ${QT_LIBRARIES})
-endif()
-
-# -- Test
# UIC only
if(ALLOW_WRAP_CPP)
qtx_wrap_cpp(uicOnlyMoc uicOnlySource/uiconly.h)
@@ -188,8 +179,10 @@ set_property(TARGET skipRccB PROPERTY AUTOMOC ON)
target_link_libraries(skipRccB ${QT_LIBRARIES})
# -- Test
-# Source files with the same basename in different subdirectories
-add_subdirectory(sameName)
+# MOC AUTOMOC_MACRO_NAMES
+if (NOT QT_TEST_VERSION STREQUAL 4)
+ add_subdirectory(mocMacroName)
+endif()
# -- Test
# Tests AUTOMOC with generated sources
@@ -217,5 +210,9 @@ add_subdirectory(uicInclude)
add_subdirectory(objectLibrary)
# -- Test
+# Source files with the same basename in different subdirectories
+add_subdirectory(sameName)
+
+# -- Test
# Complex test case
add_subdirectory(complex)
diff --git a/Tests/QtAutogen/mocMacroName/CMakeLists.txt b/Tests/QtAutogen/mocMacroName/CMakeLists.txt
new file mode 100644
index 0000000..08e6803
--- /dev/null
+++ b/Tests/QtAutogen/mocMacroName/CMakeLists.txt
@@ -0,0 +1,8 @@
+cmake_minimum_required(VERSION 3.9)
+
+list(APPEND CMAKE_AUTOMOC_MACRO_NAMES "QO1_ALIAS")
+
+add_executable(mmn main.cpp Gadget.cpp Object.cpp Object1Aliased.cpp Object2Aliased.cpp)
+set_property(TARGET mmn PROPERTY AUTOMOC ON)
+set_property(TARGET mmn APPEND PROPERTY AUTOMOC_MACRO_NAMES "QO2_ALIAS")
+target_link_libraries(mmn ${QT_LIBRARIES})
diff --git a/Tests/QtAutogen/mocMacroName/CustomMacros.hpp b/Tests/QtAutogen/mocMacroName/CustomMacros.hpp
new file mode 100644
index 0000000..93e5bfd
--- /dev/null
+++ b/Tests/QtAutogen/mocMacroName/CustomMacros.hpp
@@ -0,0 +1,8 @@
+#ifndef CUSTOM_MACROS_HPP
+#define CUSTOM_MACROS_HPP
+
+#include <QObject>
+#define QO1_ALIAS Q_OBJECT
+#define QO2_ALIAS Q_OBJECT
+
+#endif
diff --git a/Tests/QtAutogen/mocMacroName/Gadget.cpp b/Tests/QtAutogen/mocMacroName/Gadget.cpp
new file mode 100644
index 0000000..167faeb
--- /dev/null
+++ b/Tests/QtAutogen/mocMacroName/Gadget.cpp
@@ -0,0 +1,6 @@
+#include "Gadget.hpp"
+
+Gadget::Gadget()
+ : test(0)
+{
+}
diff --git a/Tests/QtAutogen/mocMacroName/Gadget.hpp b/Tests/QtAutogen/mocMacroName/Gadget.hpp
new file mode 100644
index 0000000..2587ed2
--- /dev/null
+++ b/Tests/QtAutogen/mocMacroName/Gadget.hpp
@@ -0,0 +1,15 @@
+#ifndef GADGET_HPP
+#define GADGET_HPP
+
+#include <QMetaType>
+
+class Gadget
+{
+ Q_GADGET
+ Q_PROPERTY(int test MEMBER test)
+public:
+ Gadget();
+ int test;
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocMacroName/MacroAlias.hpp b/Tests/QtAutogen/mocMacroName/MacroAlias.hpp
deleted file mode 100644
index cf06f2a..0000000
--- a/Tests/QtAutogen/mocMacroName/MacroAlias.hpp
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef MACROALIAS_HPP
-#define MACROALIAS_HPP
-
-#include <QObject>
-#define QO_ALIAS Q_OBJECT
-
-#endif
diff --git a/Tests/QtAutogen/mocMacroName/MacroName.cpp b/Tests/QtAutogen/mocMacroName/MacroName.cpp
deleted file mode 100644
index 78d04a8..0000000
--- a/Tests/QtAutogen/mocMacroName/MacroName.cpp
+++ /dev/null
@@ -1,9 +0,0 @@
-#include "MacroName.hpp"
-
-MacroName::MacroName()
-{
-}
-
-void MacroName::aSlot()
-{
-}
diff --git a/Tests/QtAutogen/mocMacroName/MacroName.hpp b/Tests/QtAutogen/mocMacroName/MacroName.hpp
deleted file mode 100644
index b6c7306..0000000
--- a/Tests/QtAutogen/mocMacroName/MacroName.hpp
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef MACRONAME_HPP
-#define MACRONAME_HPP
-
-#include "MacroAlias.hpp"
-
-// Test Qt object macro hidden in a macro (AUTOMOC_MACRO_NAMES)
-class MacroName : public QObject
-{
- QO_ALIAS
-public:
- MacroName();
-
-signals:
- void aSignal();
-
-public slots:
- void aSlot();
-};
-
-#endif
diff --git a/Tests/QtAutogen/mocMacroName/Object.cpp b/Tests/QtAutogen/mocMacroName/Object.cpp
new file mode 100644
index 0000000..c0b4f33
--- /dev/null
+++ b/Tests/QtAutogen/mocMacroName/Object.cpp
@@ -0,0 +1,9 @@
+#include "Object.hpp"
+
+Object::Object()
+{
+}
+
+void Object::aSlot()
+{
+}
diff --git a/Tests/QtAutogen/mocMacroName/Object.hpp b/Tests/QtAutogen/mocMacroName/Object.hpp
new file mode 100644
index 0000000..0c40824
--- /dev/null
+++ b/Tests/QtAutogen/mocMacroName/Object.hpp
@@ -0,0 +1,19 @@
+#ifndef OBJECT_HPP
+#define OBJECT_HPP
+
+#include <QObject>
+
+class Object : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int test MEMBER test)
+public:
+ Object();
+
+ Q_SLOT
+ void aSlot();
+
+ int test;
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocMacroName/Object1Aliased.cpp b/Tests/QtAutogen/mocMacroName/Object1Aliased.cpp
new file mode 100644
index 0000000..b8b4806
--- /dev/null
+++ b/Tests/QtAutogen/mocMacroName/Object1Aliased.cpp
@@ -0,0 +1,9 @@
+#include "Object1Aliased.hpp"
+
+Object1Aliased::Object1Aliased()
+{
+}
+
+void Object1Aliased::aSlot()
+{
+}
diff --git a/Tests/QtAutogen/mocMacroName/Object1Aliased.hpp b/Tests/QtAutogen/mocMacroName/Object1Aliased.hpp
new file mode 100644
index 0000000..6c6bb40
--- /dev/null
+++ b/Tests/QtAutogen/mocMacroName/Object1Aliased.hpp
@@ -0,0 +1,20 @@
+#ifndef OBJECTALIASED_HPP
+#define OBJECTALIASED_HPP
+
+#include "CustomMacros.hpp"
+
+// Test Qt object macro hidden in a macro (AUTOMOC_MACRO_NAMES)
+class Object1Aliased : public QObject
+{
+ QO1_ALIAS
+public:
+ Object1Aliased();
+
+signals:
+ void aSignal();
+
+public slots:
+ void aSlot();
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocMacroName/Object2Aliased.cpp b/Tests/QtAutogen/mocMacroName/Object2Aliased.cpp
new file mode 100644
index 0000000..4b09dd1
--- /dev/null
+++ b/Tests/QtAutogen/mocMacroName/Object2Aliased.cpp
@@ -0,0 +1,9 @@
+#include "Object2Aliased.hpp"
+
+Object2Aliased::Object2Aliased()
+{
+}
+
+void Object2Aliased::aSlot()
+{
+}
diff --git a/Tests/QtAutogen/mocMacroName/Object2Aliased.hpp b/Tests/QtAutogen/mocMacroName/Object2Aliased.hpp
new file mode 100644
index 0000000..b9bdc12
--- /dev/null
+++ b/Tests/QtAutogen/mocMacroName/Object2Aliased.hpp
@@ -0,0 +1,20 @@
+#ifndef OBJECT2ALIASED_HPP
+#define OBJECT2ALIASED_HPP
+
+#include "CustomMacros.hpp"
+
+// Test Qt object macro hidden in a macro (AUTOMOC_MACRO_NAMES)
+class Object2Aliased : public QObject
+{
+ QO2_ALIAS
+public:
+ Object2Aliased();
+
+signals:
+ void aSignal();
+
+public slots:
+ void aSlot();
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocMacroName/main.cpp b/Tests/QtAutogen/mocMacroName/main.cpp
index 67ee81f..3b45d04 100644
--- a/Tests/QtAutogen/mocMacroName/main.cpp
+++ b/Tests/QtAutogen/mocMacroName/main.cpp
@@ -1,7 +1,13 @@
-#include "MacroName.hpp"
+#include "Gadget.hpp"
+#include "Object.hpp"
+#include "Object1Aliased.hpp"
+#include "Object2Aliased.hpp"
int main(int argv, char** args)
{
- MacroName macroName;
+ Gadget gadget;
+ Object object;
+ Object1Aliased object1Aliased;
+ Object2Aliased object2Aliased;
return 0;
}
diff --git a/Tests/QtAutogen/sameName/CMakeLists.txt b/Tests/QtAutogen/sameName/CMakeLists.txt
index 4d2dcd9..f695875 100644
--- a/Tests/QtAutogen/sameName/CMakeLists.txt
+++ b/Tests/QtAutogen/sameName/CMakeLists.txt
@@ -17,7 +17,10 @@ add_executable(sameName
main.cpp
)
target_link_libraries(sameName ${QT_LIBRARIES})
-set_target_properties(sameName PROPERTIES AUTOMOC TRUE AUTORCC TRUE)
+set_target_properties(sameName PROPERTIES
+ AUTOMOC TRUE
+ AUTOUIC TRUE
+ AUTORCC TRUE)
# Set different compression levels
if (QT_TEST_VERSION STREQUAL 4)
diff --git a/Tests/QtAutogen/sameName/aaa/bbb/item.cpp b/Tests/QtAutogen/sameName/aaa/bbb/item.cpp
index 20d0044..850206f 100644
--- a/Tests/QtAutogen/sameName/aaa/bbb/item.cpp
+++ b/Tests/QtAutogen/sameName/aaa/bbb/item.cpp
@@ -3,8 +3,20 @@
namespace aaa {
namespace bbb {
+class MocLocal : public QObject
+{
+ Q_OBJECT;
+
+public:
+ MocLocal() = default;
+ ~MocLocal() = default;
+};
+
void Item::go()
{
+ MocLocal obj;
}
}
}
+
+#include "aaa/bbb/item.moc"
diff --git a/Tests/QtAutogen/sameName/aaa/item.cpp b/Tests/QtAutogen/sameName/aaa/item.cpp
index 95dd3b6..e35d3d1 100644
--- a/Tests/QtAutogen/sameName/aaa/item.cpp
+++ b/Tests/QtAutogen/sameName/aaa/item.cpp
@@ -1,8 +1,22 @@
#include "item.hpp"
+// Include ui_view.h only in header
namespace aaa {
+class MocLocal : public QObject
+{
+ Q_OBJECT;
+
+public:
+ MocLocal() = default;
+ ~MocLocal() = default;
+};
+
void Item::go()
{
+ Ui_ViewAAA ui;
+ MocLocal obj;
}
}
+
+#include "aaa/item.moc"
diff --git a/Tests/QtAutogen/sameName/aaa/item.hpp b/Tests/QtAutogen/sameName/aaa/item.hpp
index b63466f..875f72f 100644
--- a/Tests/QtAutogen/sameName/aaa/item.hpp
+++ b/Tests/QtAutogen/sameName/aaa/item.hpp
@@ -2,6 +2,8 @@
#define AAA_ITEM_HPP
#include <QObject>
+// Include ui_view.h only in header
+#include <aaa/ui_view.h>
namespace aaa {
diff --git a/Tests/QtAutogen/sameName/aaa/view.ui b/Tests/QtAutogen/sameName/aaa/view.ui
new file mode 100644
index 0000000..0f09980
--- /dev/null
+++ b/Tests/QtAutogen/sameName/aaa/view.ui
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ViewAAA</class>
+ <widget class="QWidget" name="Base">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QTreeView" name="treeView"/>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/Tests/QtAutogen/sameName/bbb/aaa/item.cpp b/Tests/QtAutogen/sameName/bbb/aaa/item.cpp
index ac4b2c2..7ad01c3 100644
--- a/Tests/QtAutogen/sameName/bbb/aaa/item.cpp
+++ b/Tests/QtAutogen/sameName/bbb/aaa/item.cpp
@@ -3,8 +3,20 @@
namespace bbb {
namespace aaa {
+class MocLocal : public QObject
+{
+ Q_OBJECT;
+
+public:
+ MocLocal() = default;
+ ~MocLocal() = default;
+};
+
void Item::go()
{
+ MocLocal obj;
}
}
}
+
+#include "bbb/aaa/item.moc"
diff --git a/Tests/QtAutogen/sameName/bbb/item.cpp b/Tests/QtAutogen/sameName/bbb/item.cpp
index f97a143..9ef128e 100644
--- a/Tests/QtAutogen/sameName/bbb/item.cpp
+++ b/Tests/QtAutogen/sameName/bbb/item.cpp
@@ -1,8 +1,23 @@
#include "item.hpp"
+// Include ui_view.h only in source
+#include <bbb/ui_view.h>
namespace bbb {
+class MocLocal : public QObject
+{
+ Q_OBJECT;
+
+public:
+ MocLocal() = default;
+ ~MocLocal() = default;
+};
+
void Item::go()
{
+ Ui_ViewBBB ui;
+ MocLocal obj;
}
}
+
+#include "bbb/item.moc"
diff --git a/Tests/QtAutogen/sameName/bbb/item.hpp b/Tests/QtAutogen/sameName/bbb/item.hpp
index 5b7f985..d39a9d7 100644
--- a/Tests/QtAutogen/sameName/bbb/item.hpp
+++ b/Tests/QtAutogen/sameName/bbb/item.hpp
@@ -2,6 +2,7 @@
#define BBB_ITEM_HPP
#include <QObject>
+// Include ui_view.h only in source
namespace bbb {
diff --git a/Tests/QtAutogen/sameName/bbb/view.ui b/Tests/QtAutogen/sameName/bbb/view.ui
new file mode 100644
index 0000000..a8f506e
--- /dev/null
+++ b/Tests/QtAutogen/sameName/bbb/view.ui
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ViewBBB</class>
+ <widget class="QWidget" name="Base">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QTreeView" name="treeView"/>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/Tests/QtAutogen/sameName/ccc/item.cpp b/Tests/QtAutogen/sameName/ccc/item.cpp
index d90b2b8..ab8a281 100644
--- a/Tests/QtAutogen/sameName/ccc/item.cpp
+++ b/Tests/QtAutogen/sameName/ccc/item.cpp
@@ -1,23 +1,25 @@
#include "item.hpp"
+// Include ui_view.h in source and header
+#include <ccc/ui_view.h>
namespace ccc {
-void Item::go()
-{
-}
-
-class MocTest : public QObject
+class MocLocal : public QObject
{
Q_OBJECT;
- Q_SLOT
- void go();
+
+public:
+ MocLocal() = default;
+ ~MocLocal() = default;
};
-void MocTest::go()
+void Item::go()
{
+ Ui_ViewCCC ui;
+ MocLocal obj;
}
}
// Include own moc files
-#include "item.moc"
+#include "ccc/item.moc"
#include "moc_item.cpp"
diff --git a/Tests/QtAutogen/sameName/ccc/item.hpp b/Tests/QtAutogen/sameName/ccc/item.hpp
index 96fcc24..20d9dd9 100644
--- a/Tests/QtAutogen/sameName/ccc/item.hpp
+++ b/Tests/QtAutogen/sameName/ccc/item.hpp
@@ -2,6 +2,8 @@
#define CCC_ITEM_HPP
#include <QObject>
+// Include ui_view.h in source and header
+#include <ccc/ui_view.h>
namespace ccc {
diff --git a/Tests/QtAutogen/sameName/ccc/view.ui b/Tests/QtAutogen/sameName/ccc/view.ui
new file mode 100644
index 0000000..7989c69
--- /dev/null
+++ b/Tests/QtAutogen/sameName/ccc/view.ui
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ViewCCC</class>
+ <widget class="QWidget" name="Base">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QTreeView" name="treeView"/>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/Tests/QtAutogen/sameName/item.cpp b/Tests/QtAutogen/sameName/item.cpp
index e013cf3..3d1fbe7 100644
--- a/Tests/QtAutogen/sameName/item.cpp
+++ b/Tests/QtAutogen/sameName/item.cpp
@@ -1,5 +1,20 @@
#include "item.hpp"
+// Include ui_view.h in source and header
+#include <ui_view.h>
+
+class MocLocal : public QObject
+{
+ Q_OBJECT;
+
+public:
+ MocLocal() = default;
+ ~MocLocal() = default;
+};
void Item::go()
{
+ Ui_View ui;
+ MocLocal obj;
}
+
+#include "item.moc"
diff --git a/Tests/QtAutogen/sameName/item.hpp b/Tests/QtAutogen/sameName/item.hpp
index 91bba3b..75e83f4 100644
--- a/Tests/QtAutogen/sameName/item.hpp
+++ b/Tests/QtAutogen/sameName/item.hpp
@@ -2,6 +2,8 @@
#define ITEM_HPP
#include <QObject>
+// Include ui_view.h in source and header
+#include <ui_view.h>
class Item : public QObject
{
diff --git a/Tests/QtAutogen/sameName/view.ui b/Tests/QtAutogen/sameName/view.ui
new file mode 100644
index 0000000..2ffe734
--- /dev/null
+++ b/Tests/QtAutogen/sameName/view.ui
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>View</class>
+ <widget class="QWidget" name="Base">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QTreeView" name="treeView"/>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/Tests/QtAutogenRerun/CMakeLists.txt b/Tests/QtAutogenRerun/CMakeLists.txt
index 088025f..e72c191 100644
--- a/Tests/QtAutogenRerun/CMakeLists.txt
+++ b/Tests/QtAutogenRerun/CMakeLists.txt
@@ -36,204 +36,17 @@ else()
endif()
-# -- Test
-# Dummy test to generate clean target
+# Dummy executable to generate clean target
add_executable(dummy dummy.cpp)
# -- Test
-# When a file listed in a .qrc file changes the target must be rebuilt
-set(timeformat "%Y%j%H%M%S")
-set(RCC_DEPENDS_SRC "${CMAKE_CURRENT_SOURCE_DIR}/rccDepends")
-set(RCC_DEPENDS_BIN "${CMAKE_CURRENT_BINARY_DIR}/rccDepends")
-configure_file(${RCC_DEPENDS_SRC}/res1a.qrc.in ${RCC_DEPENDS_BIN}/res1.qrc COPYONLY)
-configure_file(${RCC_DEPENDS_SRC}/res2a.qrc.in ${RCC_DEPENDS_BIN}/res2.qrc.in COPYONLY)
-try_compile(RCC_DEPENDS
- "${RCC_DEPENDS_BIN}"
- "${RCC_DEPENDS_SRC}"
- rccDepends
- CMAKE_FLAGS "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
- "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
- "-DCMAKE_PREFIX_PATH=${Qt_PREFIX_DIR}"
- OUTPUT_VARIABLE output
-)
-if (NOT RCC_DEPENDS)
- message(SEND_ERROR "Initial build of rccDepends failed. Output: ${output}")
-endif()
-# Get name and timestamp of the output binary
-file(STRINGS "${RCC_DEPENDS_BIN}/target.txt" targetList ENCODING UTF-8)
-list(GET targetList 0 rccDependsBin)
-file(TIMESTAMP "${rccDependsBin}" timeBegin "${timeformat}")
-# Sleep, touch regular qrc input file, rebuild and compare timestamp
-execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) # Ensure that the timestamp will change.
-execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${RCC_DEPENDS_BIN}/res1/input.txt")
-execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${RCC_DEPENDS_BIN}" RESULT_VARIABLE result)
-if (result)
- message(SEND_ERROR "Second build of rccDepends failed.")
-endif()
-file(TIMESTAMP "${rccDependsBin}" timeStep1 "${timeformat}")
-if (NOT timeStep1 GREATER timeBegin)
- message(SEND_ERROR "File (${rccDependsBin}) should have changed in the first step!")
-endif()
-# Sleep, update regular qrc file, rebuild and compare timestamp
-execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) # Ensure that the timestamp will change.
-configure_file(${RCC_DEPENDS_SRC}/res1b.qrc.in ${RCC_DEPENDS_BIN}/res1.qrc COPYONLY)
-execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${RCC_DEPENDS_BIN}" RESULT_VARIABLE result)
-if (result)
- message(SEND_ERROR "Third build of rccDepends failed.")
-endif()
-file(TIMESTAMP "${rccDependsBin}" timeStep2 "${timeformat}")
-if (NOT timeStep2 GREATER timeStep1)
- message(SEND_ERROR "File (${rccDependsBin}) should have changed in the second step!")
-endif()
-# Sleep, touch regular qrc newly added input file, rebuild and compare timestamp
-execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) # Ensure that the timestamp will change.
-execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${RCC_DEPENDS_BIN}/res1/inputAdded.txt")
-execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${RCC_DEPENDS_BIN}" RESULT_VARIABLE result)
-if (result)
- message(SEND_ERROR "Fourth build of rccDepends failed.")
-endif()
-file(TIMESTAMP "${rccDependsBin}" timeStep3 "${timeformat}")
-if (NOT timeStep3 GREATER timeStep2)
- message(SEND_ERROR "File (${rccDependsBin}) should have changed in the third step!")
-endif()
-# Sleep, touch generated qrc input file, rebuild and compare timestamp
-execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) # Ensure that the timestamp will change.
-execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${RCC_DEPENDS_BIN}/res2/input.txt")
-execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${RCC_DEPENDS_BIN}" RESULT_VARIABLE result)
-if (result)
- message(SEND_ERROR "Fifth build of rccDepends failed.")
-endif()
-file(TIMESTAMP "${rccDependsBin}" timeStep4 "${timeformat}")
-if (NOT timeStep4 GREATER timeStep3)
- message(SEND_ERROR "File (${rccDependsBin}) should have changed in the fourth step!")
-endif()
-# Sleep, update generated qrc file, rebuild and compare timestamp
-execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) # Ensure that the timestamp will change.
-configure_file(${RCC_DEPENDS_SRC}/res2b.qrc.in ${RCC_DEPENDS_BIN}/res2.qrc.in COPYONLY)
-execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${RCC_DEPENDS_BIN}" RESULT_VARIABLE result)
-if (result)
- message(SEND_ERROR "Sixth build of rccDepends failed.")
-endif()
-file(TIMESTAMP "${rccDependsBin}" timeStep5 "${timeformat}")
-if (NOT timeStep5 GREATER timeStep4)
- message(SEND_ERROR "File (${rccDependsBin}) should have changed in the fitfh step!")
-endif()
-# Sleep, touch generated qrc newly added input file, rebuild and compare timestamp
-execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) # Ensure that the timestamp will change.
-execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${RCC_DEPENDS_BIN}/res2/inputAdded.txt")
-execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${RCC_DEPENDS_BIN}" RESULT_VARIABLE result)
-if (result)
- message(SEND_ERROR "Seventh build of rccDepends failed.")
-endif()
-file(TIMESTAMP "${rccDependsBin}" timeStep6 "${timeformat}")
-if (NOT timeStep6 GREATER timeStep5)
- message(SEND_ERROR "File (${rccDependsBin}) should have changed in the sixth step!")
-endif()
-
-
-# -- Test
-# Ensure a repeated build succeeds when a header containing a QObject changes
-set(timeformat "%Y%j%H%M%S")
-configure_file(mocRerun/test1a.h.in mocRerun/test1.h COPYONLY)
-try_compile(MOC_RERUN
- "${CMAKE_CURRENT_BINARY_DIR}/mocRerun"
- "${CMAKE_CURRENT_SOURCE_DIR}/mocRerun"
- mocRerun
- CMAKE_FLAGS "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
- "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
- "-DCMAKE_PREFIX_PATH=${Qt_PREFIX_DIR}"
- OUTPUT_VARIABLE output
-)
-if (NOT MOC_RERUN)
- message(SEND_ERROR "Initial build of mocRerun failed. Output: ${output}")
-endif()
-# Get name and timestamp of the output binary
-file(STRINGS "${CMAKE_CURRENT_BINARY_DIR}/mocRerun/target1.txt" target1List ENCODING UTF-8)
-list(GET target1List 0 binFile)
-file(TIMESTAMP "${binFile}" timeBegin "${timeformat}")
-# Change file content and rebuild
-execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
-configure_file(mocRerun/test1b.h.in mocRerun/test1.h COPYONLY)
-execute_process(COMMAND "${CMAKE_COMMAND}" --build .
- WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/mocRerun"
- RESULT_VARIABLE mocRerun_result
- )
-if (mocRerun_result)
- message(SEND_ERROR "Second build of mocRerun failed.")
-endif()
-# Compare timestamps
-file(TIMESTAMP "${binFile}" timeStep1 "${timeformat}")
-if (NOT timeStep1 GREATER timeBegin)
- message(SEND_ERROR "File (${binFile}) should have changed in the first step!")
-endif()
-
+include("mocRerun.cmake")
# -- Test
# Tests Q_PLUGIN_METADATA json file change detection
if (NOT QT_TEST_VERSION STREQUAL 4)
- try_compile(MOC_PLUGIN
- "${CMAKE_CURRENT_BINARY_DIR}/mocPlugin"
- "${CMAKE_CURRENT_SOURCE_DIR}/mocPlugin"
- mocPlugin
- CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
- "-DCMAKE_PREFIX_PATH=${Qt_PREFIX_DIR}"
- OUTPUT_VARIABLE output
- )
- if (NOT MOC_PLUGIN)
- message(SEND_ERROR "Initial build of mocPlugin failed. Output: ${output}")
- endif()
-
- set(timeformat "%Y%j%H%M%S")
- set(mocPlugSrcDir "${CMAKE_CURRENT_SOURCE_DIR}/mocPlugin")
- set(mocPlugBinDir "${CMAKE_CURRENT_BINARY_DIR}/mocPlugin")
- find_library(plAFile "PlugA" PATHS "${mocPlugBinDir}/Debug" "${mocPlugBinDir}" NO_DEFAULT_PATH)
- find_library(plBFile "PlugB" PATHS "${mocPlugBinDir}/Debug" "${mocPlugBinDir}" NO_DEFAULT_PATH)
- find_library(plCFile "PlugC" PATHS "${mocPlugBinDir}/Debug" "${mocPlugBinDir}" NO_DEFAULT_PATH)
- find_library(plDFile "PlugD" PATHS "${mocPlugBinDir}/Debug" "${mocPlugBinDir}" NO_DEFAULT_PATH)
-
- file(TIMESTAMP "${plAFile}" plABefore "${timeformat}")
- file(TIMESTAMP "${plBFile}" plBBefore "${timeformat}")
- file(TIMESTAMP "${plCFile}" plCBefore "${timeformat}")
- file(TIMESTAMP "${plDFile}" plDBefore "${timeformat}")
-
- # Ensure that the timestamp will change and change the json files
- execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
- configure_file("${mocPlugSrcDir}/jsonIn/StyleD.json" "${mocPlugBinDir}/jsonFiles/StyleC.json")
- configure_file("${mocPlugSrcDir}/jsonIn/StyleC.json" "${mocPlugBinDir}/jsonFiles/sub/StyleD.json")
- execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocPlugBinDir}")
-
- file(TIMESTAMP "${plAFile}" plAAfter "${timeformat}")
- file(TIMESTAMP "${plBFile}" plBAfter "${timeformat}")
- file(TIMESTAMP "${plCFile}" plCAfter "${timeformat}")
- file(TIMESTAMP "${plDFile}" plDAfter "${timeformat}")
-
- if (plAAfter GREATER plABefore)
- message(SEND_ERROR "file (${plAFile}) should not have changed!")
- endif()
- if (plBAfter GREATER plBBefore)
- message(SEND_ERROR "file (${plBFile}) should not have changed!")
- endif()
- if (NOT plCAfter GREATER plCBefore)
- message(SEND_ERROR "file (${plCFile}) should have changed!")
- endif()
- if (NOT plDAfter GREATER plDBefore)
- message(SEND_ERROR "file (${plDFile}) should have changed!")
- endif()
-
- # Test custom macro
- file(TIMESTAMP "${plCFile}" plCBefore "${timeformat}")
- file(TIMESTAMP "${plDFile}" plDBefore "${timeformat}")
- execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
- configure_file("${mocPlugSrcDir}/jsonIn/StyleD.json" "${mocPlugBinDir}/jsonFiles/StyleC_Custom.json")
- configure_file("${mocPlugSrcDir}/jsonIn/StyleC.json" "${mocPlugBinDir}/jsonFiles/sub/StyleD_Custom.json")
- execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocPlugBinDir}")
- file(TIMESTAMP "${plCFile}" plCAfter "${timeformat}")
- file(TIMESTAMP "${plDFile}" plDAfter "${timeformat}")
- if (NOT plCAfter GREATER plCBefore)
- message(SEND_ERROR "file (${plCFile}) should have changed!")
- endif()
- if (NOT plDAfter GREATER plDBefore)
- message(SEND_ERROR "file (${plDFile}) should have changed!")
- endif()
-
+ include("mocPlugin.cmake")
endif()
+
+# -- Test
+include("rccDepends.cmake")
diff --git a/Tests/QtAutogenRerun/mocPlugin.cmake b/Tests/QtAutogenRerun/mocPlugin.cmake
new file mode 100644
index 0000000..7ad5ccb
--- /dev/null
+++ b/Tests/QtAutogenRerun/mocPlugin.cmake
@@ -0,0 +1,96 @@
+
+# Utility variables
+set(timeformat "%Y%j%H%M%S")
+set(mocPlugSrcDir "${CMAKE_CURRENT_SOURCE_DIR}/mocPlugin")
+set(mocPlugBinDir "${CMAKE_CURRENT_BINARY_DIR}/mocPlugin")
+
+# Initial buid
+try_compile(MOC_PLUGIN
+ "${mocPlugBinDir}"
+ "${mocPlugSrcDir}"
+ mocPlugin
+ CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
+ "-DCMAKE_PREFIX_PATH=${Qt_PREFIX_DIR}"
+ OUTPUT_VARIABLE output
+)
+if (NOT MOC_PLUGIN)
+ message(SEND_ERROR "Initial build of mocPlugin failed. Output: ${output}")
+endif()
+
+find_library(plAFile "PlugA" PATHS "${mocPlugBinDir}/Debug" "${mocPlugBinDir}" NO_DEFAULT_PATH)
+find_library(plBFile "PlugB" PATHS "${mocPlugBinDir}/Debug" "${mocPlugBinDir}" NO_DEFAULT_PATH)
+find_library(plCFile "PlugC" PATHS "${mocPlugBinDir}/Debug" "${mocPlugBinDir}" NO_DEFAULT_PATH)
+find_library(plDFile "PlugD" PATHS "${mocPlugBinDir}/Debug" "${mocPlugBinDir}" NO_DEFAULT_PATH)
+find_library(plEFile "PlugE" PATHS "${mocPlugBinDir}/Debug" "${mocPlugBinDir}" NO_DEFAULT_PATH)
+
+# - Ensure that the timestamp will change.
+# - Change the json files referenced by Q_PLUGIN_METADATA
+# - Rebuild
+file(TIMESTAMP "${plAFile}" plABefore "${timeformat}")
+file(TIMESTAMP "${plBFile}" plBBefore "${timeformat}")
+file(TIMESTAMP "${plCFile}" plCBefore "${timeformat}")
+file(TIMESTAMP "${plDFile}" plDBefore "${timeformat}")
+file(TIMESTAMP "${plEFile}" plEBefore "${timeformat}")
+
+execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
+configure_file("${mocPlugSrcDir}/jsonIn/StyleD.json" "${mocPlugBinDir}/jsonFiles/StyleC.json")
+configure_file("${mocPlugSrcDir}/jsonIn/StyleE.json" "${mocPlugBinDir}/jsonFiles/sub/StyleD.json")
+configure_file("${mocPlugSrcDir}/jsonIn/StyleC.json" "${mocPlugBinDir}/jsonFiles/StyleE.json")
+execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocPlugBinDir}")
+
+file(TIMESTAMP "${plAFile}" plAAfter "${timeformat}")
+file(TIMESTAMP "${plBFile}" plBAfter "${timeformat}")
+file(TIMESTAMP "${plCFile}" plCAfter "${timeformat}")
+file(TIMESTAMP "${plDFile}" plDAfter "${timeformat}")
+file(TIMESTAMP "${plEFile}" plEAfter "${timeformat}")
+
+if (plAAfter GREATER plABefore)
+ message(SEND_ERROR "file (${plAFile}) should not have changed!")
+endif()
+if (plBAfter GREATER plBBefore)
+ message(SEND_ERROR "file (${plBFile}) should not have changed!")
+endif()
+if (NOT plCAfter GREATER plCBefore)
+ message(SEND_ERROR "file (${plCFile}) should have changed!")
+endif()
+if (NOT plDAfter GREATER plDBefore)
+ message(SEND_ERROR "file (${plDFile}) should have changed!")
+endif()
+if (NOT plEAfter GREATER plEBefore)
+ # There's a bug in Ninja on Windows
+ # https://gitlab.kitware.com/cmake/cmake/issues/16776
+ if(NOT ("${CMAKE_GENERATOR}" MATCHES "Ninja"))
+ message(SEND_ERROR "file (${plEFile}) should have changed!")
+ endif()
+endif()
+
+# - Ensure that the timestamp will change.
+# - Change the json files referenced by A_CUSTOM_MACRO
+# - Rebuild
+file(TIMESTAMP "${plCFile}" plCBefore "${timeformat}")
+file(TIMESTAMP "${plDFile}" plDBefore "${timeformat}")
+file(TIMESTAMP "${plEFile}" plEBefore "${timeformat}")
+
+execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
+configure_file("${mocPlugSrcDir}/jsonIn/StyleE.json" "${mocPlugBinDir}/jsonFiles/StyleC_Custom.json")
+configure_file("${mocPlugSrcDir}/jsonIn/StyleC.json" "${mocPlugBinDir}/jsonFiles/sub/StyleD_Custom.json")
+configure_file("${mocPlugSrcDir}/jsonIn/StyleD.json" "${mocPlugBinDir}/jsonFiles/StyleE_Custom.json")
+execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocPlugBinDir}")
+
+file(TIMESTAMP "${plCFile}" plCAfter "${timeformat}")
+file(TIMESTAMP "${plDFile}" plDAfter "${timeformat}")
+file(TIMESTAMP "${plEFile}" plEAfter "${timeformat}")
+
+if (NOT plCAfter GREATER plCBefore)
+ message(SEND_ERROR "file (${plCFile}) should have changed!")
+endif()
+if (NOT plDAfter GREATER plDBefore)
+ message(SEND_ERROR "file (${plDFile}) should have changed!")
+endif()
+if (NOT plEAfter GREATER plEBefore)
+ # There's a bug in Ninja on Windows
+ # https://gitlab.kitware.com/cmake/cmake/issues/16776
+ if(NOT ("${CMAKE_GENERATOR}" MATCHES "Ninja"))
+ message(SEND_ERROR "file (${plEFile}) should have changed!")
+ endif()
+endif()
diff --git a/Tests/QtAutogenRerun/mocPlugin/CMakeLists.txt b/Tests/QtAutogenRerun/mocPlugin/CMakeLists.txt
index 9b224fb..b7cc5e9 100644
--- a/Tests/QtAutogenRerun/mocPlugin/CMakeLists.txt
+++ b/Tests/QtAutogenRerun/mocPlugin/CMakeLists.txt
@@ -16,9 +16,11 @@ if(Qt5_POSITION_INDEPENDENT_CODE AND CMAKE_CXX_COMPILE_OPTIONS_PIC)
endif()
configure_file(jsonIn/StyleC.json jsonFiles/StyleC.json)
-configure_file(jsonIn/StyleD.json jsonFiles/sub/StyleD.json)
configure_file(jsonIn/StyleC.json jsonFiles/StyleC_Custom.json)
+configure_file(jsonIn/StyleD.json jsonFiles/sub/StyleD.json)
configure_file(jsonIn/StyleD.json jsonFiles/sub/StyleD_Custom.json)
+configure_file(jsonIn/StyleE.json jsonFiles/StyleE.json)
+configure_file(jsonIn/StyleE.json jsonFiles/StyleE_Custom.json)
# Enable automoc
set(CMAKE_AUTOMOC TRUE)
diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleA.hpp b/Tests/QtAutogenRerun/mocPlugin/StyleA.hpp
index 1b6154d..35158a4 100644
--- a/Tests/QtAutogenRerun/mocPlugin/StyleA.hpp
+++ b/Tests/QtAutogenRerun/mocPlugin/StyleA.hpp
@@ -1,13 +1,13 @@
#ifndef STYLEA_HPP
#define STYLEA_HPP
-#include "StyleCommon.hpp"
+#include "UtilityMacros.hpp"
#include <QStylePlugin>
class StyleA : public QStylePlugin
{
Q_OBJECT
- // Json file in local directory
+ // Json file in source local directory
Q_PLUGIN_METADATA(IID "org.styles.A" FILE "StyleA.json")
A_CUSTOM_MACRO(SomeArg, "StyleA_Custom.json", AnotherArg)
public:
diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleB.hpp b/Tests/QtAutogenRerun/mocPlugin/StyleB.hpp
index 163c9b2..15b79c5 100644
--- a/Tests/QtAutogenRerun/mocPlugin/StyleB.hpp
+++ b/Tests/QtAutogenRerun/mocPlugin/StyleB.hpp
@@ -1,13 +1,13 @@
#ifndef STYLEB_HPP
#define STYLEB_HPP
-#include "StyleCommon.hpp"
+#include "UtilityMacros.hpp"
#include <QStylePlugin>
class StyleB : public QStylePlugin
{
Q_OBJECT
- // Json file in local subdirectory
+ // Json file in source local subdirectory
Q_PLUGIN_METADATA(IID "org.styles.B" FILE "jsonIn/StyleB.json")
A_CUSTOM_MACRO(SomeArg, "jsonIn/StyleB_Custom.json", AnotherArg)
public:
diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleC.hpp b/Tests/QtAutogenRerun/mocPlugin/StyleC.hpp
index 52a887a..b0a4115 100644
--- a/Tests/QtAutogenRerun/mocPlugin/StyleC.hpp
+++ b/Tests/QtAutogenRerun/mocPlugin/StyleC.hpp
@@ -1,7 +1,7 @@
#ifndef STYLEC_HPP
#define STYLEC_HPP
-#include "StyleCommon.hpp"
+#include "UtilityMacros.hpp"
#include <QStylePlugin>
class StyleC : public QStylePlugin
diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleD.hpp b/Tests/QtAutogenRerun/mocPlugin/StyleD.hpp
index df8a439..9696aaa 100644
--- a/Tests/QtAutogenRerun/mocPlugin/StyleD.hpp
+++ b/Tests/QtAutogenRerun/mocPlugin/StyleD.hpp
@@ -1,7 +1,7 @@
#ifndef STYLED_HPP
#define STYLED_HPP
-#include "StyleCommon.hpp"
+#include "UtilityMacros.hpp"
#include <QStylePlugin>
class StyleD : public QStylePlugin
diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleE.cpp b/Tests/QtAutogenRerun/mocPlugin/StyleE.cpp
index 8fc9a7f..3448319 100644
--- a/Tests/QtAutogenRerun/mocPlugin/StyleE.cpp
+++ b/Tests/QtAutogenRerun/mocPlugin/StyleE.cpp
@@ -4,3 +4,6 @@ QStyle* StyleE::create(const QString& key)
{
return 0;
}
+
+// AUTOMOC the StyleEInclude.hpp header
+#include "moc_StyleEInclude.cpp"
diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleE.hpp b/Tests/QtAutogenRerun/mocPlugin/StyleE.hpp
index e7915a8..a069034 100644
--- a/Tests/QtAutogenRerun/mocPlugin/StyleE.hpp
+++ b/Tests/QtAutogenRerun/mocPlugin/StyleE.hpp
@@ -1,17 +1,10 @@
#ifndef STYLEE_HPP
#define STYLEE_HPP
-#include "StyleCommon.hpp"
-#include <QStylePlugin>
-
-class StyleE : public QStylePlugin
-{
- Q_OBJECT
- // No Json file
- Q_PLUGIN_METADATA(IID "org.styles.E")
- A_CUSTOM_MACRO(SomeArg, InvalidFileArg, AnotherArg)
-public:
- QStyle* create(const QString& key);
-};
+// The included file is not in the sources list and won't be detected by
+// AUTOMOC source file with the same base name.
+// It is registered to AUTOMOCed via a moc_<NAME>.cpp include in StyleE.cpp
+// though.
+#include "StyleEInclude.hpp"
#endif
diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleEInclude.hpp b/Tests/QtAutogenRerun/mocPlugin/StyleEInclude.hpp
new file mode 100644
index 0000000..f9734db
--- /dev/null
+++ b/Tests/QtAutogenRerun/mocPlugin/StyleEInclude.hpp
@@ -0,0 +1,17 @@
+#ifndef STYLEE_INCLUDE_HPP
+#define STYLEE_INCLUDE_HPP
+
+#include "UtilityMacros.hpp"
+#include <QStylePlugin>
+
+class StyleE : public QStylePlugin
+{
+ Q_OBJECT
+ // Json files in global root directory
+ Q_PLUGIN_METADATA(IID "org.styles.E" FILE "StyleE.json")
+ A_CUSTOM_MACRO(SomeArg, "StyleE_Custom.json", AnotherArg)
+public:
+ QStyle* create(const QString& key);
+};
+
+#endif
diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleCommon.hpp b/Tests/QtAutogenRerun/mocPlugin/UtilityMacros.hpp
index f1a7ec6..53a4284 100644
--- a/Tests/QtAutogenRerun/mocPlugin/StyleCommon.hpp
+++ b/Tests/QtAutogenRerun/mocPlugin/UtilityMacros.hpp
@@ -1,5 +1,5 @@
-#ifndef STYLECOMMON_HPP
-#define STYLECOMMON_HPP
+#ifndef UTILITYMACROS_HPP
+#define UTILITYMACROS_HPP
// Empty test macro definition
#define A_CUSTOM_MACRO(name, jsonFile, pluginRegistrations)
diff --git a/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleB.json b/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleB.json
index 129cac4..cd155dc 100644
--- a/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleB.json
+++ b/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleB.json
@@ -1 +1 @@
-{ "Keys": [ "Rocket", "StarbusterB" ] }
+{ "Keys": [ "Red", "Green" ] }
diff --git a/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleE.json b/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleE.json
new file mode 100644
index 0000000..5412c94
--- /dev/null
+++ b/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleE.json
@@ -0,0 +1 @@
+{ "Keys": [ "Floor", "Ceiling" ] }
diff --git a/Tests/QtAutogenRerun/mocRerun.cmake b/Tests/QtAutogenRerun/mocRerun.cmake
new file mode 100644
index 0000000..a92912b
--- /dev/null
+++ b/Tests/QtAutogenRerun/mocRerun.cmake
@@ -0,0 +1,60 @@
+
+set(timeformat "%Y%j%H%M%S")
+set(mocRerunSrcDir "${CMAKE_CURRENT_SOURCE_DIR}/mocRerun")
+set(mocRerunBinDir "${CMAKE_CURRENT_BINARY_DIR}/mocRerun")
+
+# Initial build
+configure_file("${mocRerunSrcDir}/test1a.h.in" "${mocRerunBinDir}/test1.h" COPYONLY)
+try_compile(MOC_RERUN
+ "${mocRerunBinDir}"
+ "${mocRerunSrcDir}"
+ mocRerun
+ CMAKE_FLAGS "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
+ "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
+ "-DCMAKE_PREFIX_PATH=${Qt_PREFIX_DIR}"
+ OUTPUT_VARIABLE output
+)
+if (NOT MOC_RERUN)
+ message(SEND_ERROR "Initial build of mocRerun failed. Output: ${output}")
+endif()
+# Get name of the output binary
+file(STRINGS "${mocRerunBinDir}/mocRerun.txt" mocRerunList ENCODING UTF-8)
+list(GET mocRerunList 0 mocRerunBin)
+
+message("Changing the header content for a MOC rerun")
+# - Acquire binary timestamps before the build
+file(TIMESTAMP "${mocRerunBin}" timeBefore "${timeformat}")
+# - Ensure that the timestamp will change
+# - Change header file content and rebuild
+# - Rebuild
+execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
+configure_file("${mocRerunSrcDir}/test1b.h.in" "${mocRerunBinDir}/test1.h" COPYONLY)
+execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocRerunBinDir}" RESULT_VARIABLE result )
+if (result)
+ message(SEND_ERROR "Second build of mocRerun failed.")
+endif()
+# - Acquire binary timestamps after the build
+file(TIMESTAMP "${mocRerunBin}" timeAfter "${timeformat}")
+# - Test if timestamps changed
+if (NOT timeAfter GREATER timeBefore)
+ message(SEND_ERROR "File (${mocRerunBin}) should have changed!")
+endif()
+
+
+message("Changing nothing for a MOC rerun")
+# - Acquire binary timestamps before the build
+file(TIMESTAMP "${mocRerunBin}" timeBefore "${timeformat}")
+# - Ensure that the timestamp would change
+# - Change nothing
+# - Rebuild
+execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
+execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocRerunBinDir}" RESULT_VARIABLE result )
+if (result)
+ message(SEND_ERROR "Third build of mocRerun failed.")
+endif()
+# - Acquire binary timestamps after the build
+file(TIMESTAMP "${mocRerunBin}" timeAfter "${timeformat}")
+# - Test if timestamps changed
+if (timeAfter GREATER timeBefore)
+ message(SEND_ERROR "File (${mocRerunBin}) should not have changed!")
+endif()
diff --git a/Tests/QtAutogenRerun/mocRerun/CMakeLists.txt b/Tests/QtAutogenRerun/mocRerun/CMakeLists.txt
index 7380bdd..bafd9cf 100644
--- a/Tests/QtAutogenRerun/mocRerun/CMakeLists.txt
+++ b/Tests/QtAutogenRerun/mocRerun/CMakeLists.txt
@@ -19,17 +19,15 @@ set(CMAKE_AUTORCC ON)
# Generated source file
add_custom_command(OUTPUT main.cpp
- COMMAND ${CMAKE_COMMAND} -E sleep 2
- COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/main.cpp
- )
+ COMMAND ${CMAKE_COMMAND} -E sleep 2
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/main.cpp)
add_executable(mocRerun
${CMAKE_CURRENT_BINARY_DIR}/test1.h
${CMAKE_CURRENT_BINARY_DIR}/main.cpp
- res1.qrc
- )
+ res1.qrc)
target_include_directories(mocRerun PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(mocRerun ${QT_CORE_TARGET})
# Write target name to text file
add_custom_command(TARGET mocRerun POST_BUILD COMMAND
- ${CMAKE_COMMAND} -E echo "$<TARGET_FILE:mocRerun>" > target1.txt)
+ ${CMAKE_COMMAND} -E echo "$<TARGET_FILE:mocRerun>" > mocRerun.txt)
diff --git a/Tests/QtAutogenRerun/rccDepends.cmake b/Tests/QtAutogenRerun/rccDepends.cmake
new file mode 100644
index 0000000..68e1482
--- /dev/null
+++ b/Tests/QtAutogenRerun/rccDepends.cmake
@@ -0,0 +1,131 @@
+# When a .qrc or a file listed in a .qrc file changes,
+# the target must be rebuilt
+set(timeformat "%Y%j%H%M%S")
+set(rccDepSD "${CMAKE_CURRENT_SOURCE_DIR}/rccDepends")
+set(rccDepBD "${CMAKE_CURRENT_BINARY_DIR}/rccDepends")
+
+# Initial build
+configure_file(${rccDepSD}/resPlainA.qrc.in ${rccDepBD}/resPlain.qrc COPYONLY)
+configure_file(${rccDepSD}/resGenA.qrc.in ${rccDepBD}/resGen.qrc.in COPYONLY)
+try_compile(RCC_DEPENDS
+ "${rccDepBD}"
+ "${rccDepSD}"
+ rccDepends
+ CMAKE_FLAGS "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
+ "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
+ "-DCMAKE_PREFIX_PATH=${Qt_PREFIX_DIR}"
+ OUTPUT_VARIABLE output
+)
+if (NOT RCC_DEPENDS)
+ message(SEND_ERROR "Initial build of rccDepends failed. Output: ${output}")
+endif()
+
+# Get name of the output binaries
+file(STRINGS "${rccDepBD}/targetPlain.txt" targetListPlain ENCODING UTF-8)
+file(STRINGS "${rccDepBD}/targetGen.txt" targetListGen ENCODING UTF-8)
+list(GET targetListPlain 0 rccDepBinPlain)
+list(GET targetListGen 0 rccDepBinGen)
+message("Target that uses a plain .qrc file is:\n ${rccDepBinPlain}")
+message("Target that uses a GENERATED .qrc file is:\n ${rccDepBinGen}")
+
+
+message("Changing a resource files listed in the .qrc file")
+# - Acquire binary timestamps before the build
+file(TIMESTAMP "${rccDepBinPlain}" rdPlainBefore "${timeformat}")
+file(TIMESTAMP "${rccDepBinGen}" rdGenBefore "${timeformat}")
+# - Ensure that the timestamp will change
+# - Change a resource files listed in the .qrc file
+# - Rebuild
+execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
+execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${rccDepBD}/resPlain/input.txt")
+execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${rccDepBD}/resGen/input.txt")
+execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${rccDepBD}" RESULT_VARIABLE result)
+if (result)
+ message(SEND_ERROR "Second build of rccDepends failed.")
+endif()
+# - Acquire binary timestamps after the build
+file(TIMESTAMP "${rccDepBinPlain}" rdPlainAfter "${timeformat}")
+file(TIMESTAMP "${rccDepBinGen}" rdGenAfter "${timeformat}")
+# - Test if timestamps changed
+if (NOT rdPlainAfter GREATER rdPlainBefore)
+ message(SEND_ERROR "Plain .qrc binary ${rccDepBinPlain}) should have changed!")
+endif()
+if (NOT rdGenAfter GREATER rdGenBefore)
+ message(SEND_ERROR "GENERATED .qrc binary ${rccDepBinGen} should have changed!")
+endif()
+
+
+message("Changing a the .qrc file")
+# - Acquire binary timestamps before the build
+file(TIMESTAMP "${rccDepBinPlain}" rdPlainBefore "${timeformat}")
+file(TIMESTAMP "${rccDepBinGen}" rdGenBefore "${timeformat}")
+# - Ensure that the timestamp will change
+# - Change the .qrc file
+# - Rebuild
+execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
+configure_file(${rccDepSD}/resPlainB.qrc.in ${rccDepBD}/resPlain.qrc COPYONLY)
+configure_file(${rccDepSD}/resGenB.qrc.in ${rccDepBD}/resGen.qrc.in COPYONLY)
+execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${rccDepBD}" RESULT_VARIABLE result)
+if (result)
+ message(SEND_ERROR "Third build of rccDepends failed.")
+endif()
+# - Acquire binary timestamps after the build
+file(TIMESTAMP "${rccDepBinPlain}" rdPlainAfter "${timeformat}")
+file(TIMESTAMP "${rccDepBinGen}" rdGenAfter "${timeformat}")
+# - Test if timestamps changed
+if (NOT rdPlainAfter GREATER rdPlainBefore)
+ message(SEND_ERROR "Plain .qrc binary ${rccDepBinPlain}) should have changed!")
+endif()
+if (NOT rdGenAfter GREATER rdGenBefore)
+ message(SEND_ERROR "GENERATED .qrc binary ${rccDepBinGen} should have changed!")
+endif()
+
+
+message("Changing a newly added resource files listed in the .qrc file")
+# - Acquire binary timestamps before the build
+file(TIMESTAMP "${rccDepBinPlain}" rdPlainBefore "${timeformat}")
+file(TIMESTAMP "${rccDepBinGen}" rdGenBefore "${timeformat}")
+# - Ensure that the timestamp will change
+# - Change a newly added resource files listed in the .qrc file
+# - Rebuild
+execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
+execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${rccDepBD}/resPlain/inputAdded.txt")
+execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${rccDepBD}/resGen/inputAdded.txt")
+execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${rccDepBD}" RESULT_VARIABLE result)
+if (result)
+ message(SEND_ERROR "Fourth build of rccDepends failed.")
+endif()
+# - Acquire binary timestamps after the build
+file(TIMESTAMP "${rccDepBinPlain}" rdPlainAfter "${timeformat}")
+file(TIMESTAMP "${rccDepBinGen}" rdGenAfter "${timeformat}")
+# - Test if timestamps changed
+if (NOT rdPlainAfter GREATER rdPlainBefore)
+ message(SEND_ERROR "Plain .qrc binary ${rccDepBinPlain}) should have changed!")
+endif()
+if (NOT rdGenAfter GREATER rdGenBefore)
+ message(SEND_ERROR "GENERATED .qrc binary ${rccDepBinGen} should have changed!")
+endif()
+
+
+message("Changing nothing in the .qrc file")
+# - Acquire binary timestamps before the build
+file(TIMESTAMP "${rccDepBinPlain}" rdPlainBefore "${timeformat}")
+file(TIMESTAMP "${rccDepBinGen}" rdGenBefore "${timeformat}")
+# - Ensure that the timestamp will change
+# - Change nothing
+# - Rebuild
+execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
+execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${rccDepBD}" RESULT_VARIABLE result)
+if (result)
+ message(SEND_ERROR "Fifth build of rccDepends failed.")
+endif()
+# - Acquire binary timestamps after the build
+file(TIMESTAMP "${rccDepBinPlain}" rdPlainAfter "${timeformat}")
+file(TIMESTAMP "${rccDepBinGen}" rdGenAfter "${timeformat}")
+# - Test if timestamps changed
+if (rdPlainAfter GREATER rdPlainBefore)
+ message(SEND_ERROR "Plain .qrc binary ${rccDepBinPlain}) should NOT have changed!")
+endif()
+if (rdGenAfter GREATER rdGenBefore)
+ message(SEND_ERROR "GENERATED .qrc binary ${rccDepBinGen} should NOT have changed!")
+endif()
diff --git a/Tests/QtAutogenRerun/rccDepends/CMakeLists.txt b/Tests/QtAutogenRerun/rccDepends/CMakeLists.txt
index edc0ac3..291592e 100644
--- a/Tests/QtAutogenRerun/rccDepends/CMakeLists.txt
+++ b/Tests/QtAutogenRerun/rccDepends/CMakeLists.txt
@@ -1,8 +1,6 @@
cmake_minimum_required(VERSION 3.9)
project(rccDepends CXX)
-set(CMAKE_AUTORCC ON)
-
if (QT_TEST_VERSION STREQUAL 4)
find_package(Qt4 REQUIRED)
set(QT_CORE_TARGET Qt4::QtCore)
@@ -15,21 +13,29 @@ else()
set(QT_CORE_TARGET Qt5::Core)
endif()
-configure_file(res/input1.txt.in res1/input.txt COPYONLY)
-configure_file(res/input1.txt.in res1/inputAdded.txt COPYONLY)
-configure_file(res/input2.txt.in res2/input.txt COPYONLY)
-configure_file(res/input2.txt.in res2/inputAdded.txt COPYONLY)
-# Dependency generated qrc file
-add_custom_command(OUTPUT res2.qrc
- DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/res2.qrc.in
- COMMAND ${CMAKE_COMMAND} -E sleep 2
- COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/res2.qrc.in ${CMAKE_CURRENT_BINARY_DIR}/res2.qrc
- )
+# Enable AUTORCC for all targets
+set(CMAKE_AUTORCC ON)
+
+# Initial resource files setup
+configure_file(resPlain/input.txt.in resPlain/input.txt COPYONLY)
+configure_file(resPlain/input.txt.in resPlain/inputAdded.txt COPYONLY)
+configure_file(resGen/input.txt.in resGen/input.txt COPYONLY)
+configure_file(resGen/input.txt.in resGen/inputAdded.txt COPYONLY)
+
+# Generated qrc file with dependency
+add_custom_command(OUTPUT resGen.qrc
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc.in
+ COMMAND ${CMAKE_COMMAND} -E sleep 2
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc.in ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc)
+
+# Target that uses a plain .qrc file
+add_executable(rccDependsPlain main.cpp ${CMAKE_CURRENT_BINARY_DIR}/resPlain.qrc)
+target_link_libraries(rccDependsPlain ${QT_CORE_TARGET})
+add_custom_command(TARGET rccDependsPlain POST_BUILD COMMAND
+ ${CMAKE_COMMAND} -E echo "$<TARGET_FILE:rccDependsPlain>" > targetPlain.txt)
-add_executable(rccDepends
- main.cpp
- ${CMAKE_CURRENT_BINARY_DIR}/res1.qrc
- ${CMAKE_CURRENT_BINARY_DIR}/res2.qrc )
-target_link_libraries(rccDepends ${QT_CORE_TARGET})
-add_custom_command(TARGET rccDepends POST_BUILD COMMAND
- ${CMAKE_COMMAND} -E echo "$<TARGET_FILE:rccDepends>" > target.txt)
+# Target that uses a GENERATED .qrc file
+add_executable(rccDependsGen main.cpp ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc )
+target_link_libraries(rccDependsGen ${QT_CORE_TARGET})
+add_custom_command(TARGET rccDependsGen POST_BUILD COMMAND
+ ${CMAKE_COMMAND} -E echo "$<TARGET_FILE:rccDependsGen>" > targetGen.txt)
diff --git a/Tests/QtAutogenRerun/rccDepends/res/input1.txt.in b/Tests/QtAutogenRerun/rccDepends/res/input1.txt.in
deleted file mode 100644
index da62762..0000000
--- a/Tests/QtAutogenRerun/rccDepends/res/input1.txt.in
+++ /dev/null
@@ -1 +0,0 @@
-Res1 input.
diff --git a/Tests/QtAutogenRerun/rccDepends/res/input2.txt.in b/Tests/QtAutogenRerun/rccDepends/res/input2.txt.in
deleted file mode 100644
index 08e14b7..0000000
--- a/Tests/QtAutogenRerun/rccDepends/res/input2.txt.in
+++ /dev/null
@@ -1 +0,0 @@
-Res2 input.
diff --git a/Tests/QtAutogenRerun/rccDepends/res1a.qrc.in b/Tests/QtAutogenRerun/rccDepends/res1a.qrc.in
deleted file mode 100644
index d111ffb..0000000
--- a/Tests/QtAutogenRerun/rccDepends/res1a.qrc.in
+++ /dev/null
@@ -1,5 +0,0 @@
-<RCC>
- <qresource prefix="/Texts1">
- <file>res1/input.txt</file>
- </qresource>
-</RCC>
diff --git a/Tests/QtAutogenRerun/rccDepends/res1b.qrc.in b/Tests/QtAutogenRerun/rccDepends/res1b.qrc.in
deleted file mode 100644
index 4cb3f04..0000000
--- a/Tests/QtAutogenRerun/rccDepends/res1b.qrc.in
+++ /dev/null
@@ -1,6 +0,0 @@
-<RCC>
- <qresource prefix="/Texts1">
- <file>res1/input.txt</file>
- <file alias="Added">res1/inputAdded.txt</file>
- </qresource>
-</RCC>
diff --git a/Tests/QtAutogenRerun/rccDepends/res2a.qrc.in b/Tests/QtAutogenRerun/rccDepends/res2a.qrc.in
deleted file mode 100644
index 19f34ac..0000000
--- a/Tests/QtAutogenRerun/rccDepends/res2a.qrc.in
+++ /dev/null
@@ -1,5 +0,0 @@
-<RCC>
- <qresource prefix="/Texts2">
- <file>res2/input.txt</file>
- </qresource>
-</RCC>
diff --git a/Tests/QtAutogenRerun/rccDepends/res2b.qrc.in b/Tests/QtAutogenRerun/rccDepends/res2b.qrc.in
deleted file mode 100644
index 19e8ba1..0000000
--- a/Tests/QtAutogenRerun/rccDepends/res2b.qrc.in
+++ /dev/null
@@ -1,6 +0,0 @@
-<RCC>
- <qresource prefix="/Texts2">
- <file>res2/input.txt</file>
- <file alias="Added">res2/inputAdded.txt</file>
- </qresource>
-</RCC>
diff --git a/Tests/QtAutogenRerun/rccDepends/resGen/input.txt.in b/Tests/QtAutogenRerun/rccDepends/resGen/input.txt.in
new file mode 100644
index 0000000..4f24589
--- /dev/null
+++ b/Tests/QtAutogenRerun/rccDepends/resGen/input.txt.in
@@ -0,0 +1 @@
+Generated resource input.
diff --git a/Tests/QtAutogenRerun/rccDepends/resGen/inputAdded.txt.in b/Tests/QtAutogenRerun/rccDepends/resGen/inputAdded.txt.in
new file mode 100644
index 0000000..4f24589
--- /dev/null
+++ b/Tests/QtAutogenRerun/rccDepends/resGen/inputAdded.txt.in
@@ -0,0 +1 @@
+Generated resource input.
diff --git a/Tests/QtAutogenRerun/rccDepends/resGenA.qrc.in b/Tests/QtAutogenRerun/rccDepends/resGenA.qrc.in
new file mode 100644
index 0000000..c131a34
--- /dev/null
+++ b/Tests/QtAutogenRerun/rccDepends/resGenA.qrc.in
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/TextsGenerated">
+ <file>resGen/input.txt</file>
+ </qresource>
+</RCC>
diff --git a/Tests/QtAutogenRerun/rccDepends/resGenB.qrc.in b/Tests/QtAutogenRerun/rccDepends/resGenB.qrc.in
new file mode 100644
index 0000000..8c7e643
--- /dev/null
+++ b/Tests/QtAutogenRerun/rccDepends/resGenB.qrc.in
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/TextsGenerated">
+ <file>resGen/input.txt</file>
+ <file alias="Added">resGen/inputAdded.txt</file>
+ </qresource>
+</RCC>
diff --git a/Tests/QtAutogenRerun/rccDepends/resPlain/input.txt.in b/Tests/QtAutogenRerun/rccDepends/resPlain/input.txt.in
new file mode 100644
index 0000000..a5e407a
--- /dev/null
+++ b/Tests/QtAutogenRerun/rccDepends/resPlain/input.txt.in
@@ -0,0 +1 @@
+Plaint resource input.
diff --git a/Tests/QtAutogenRerun/rccDepends/resPlain/inputAdded.txt.in b/Tests/QtAutogenRerun/rccDepends/resPlain/inputAdded.txt.in
new file mode 100644
index 0000000..a5e407a
--- /dev/null
+++ b/Tests/QtAutogenRerun/rccDepends/resPlain/inputAdded.txt.in
@@ -0,0 +1 @@
+Plaint resource input.
diff --git a/Tests/QtAutogenRerun/rccDepends/resPlainA.qrc.in b/Tests/QtAutogenRerun/rccDepends/resPlainA.qrc.in
new file mode 100644
index 0000000..c135d85
--- /dev/null
+++ b/Tests/QtAutogenRerun/rccDepends/resPlainA.qrc.in
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/TextsPlain">
+ <file>resPlain/input.txt</file>
+ </qresource>
+</RCC>
diff --git a/Tests/QtAutogenRerun/rccDepends/resPlainB.qrc.in b/Tests/QtAutogenRerun/rccDepends/resPlainB.qrc.in
new file mode 100644
index 0000000..186b653
--- /dev/null
+++ b/Tests/QtAutogenRerun/rccDepends/resPlainB.qrc.in
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/TextsPlain">
+ <file>resPlain/input.txt</file>
+ <file alias="Added">resPlain/inputAdded.txt</file>
+ </qresource>
+</RCC>
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 73fa8fb..57cc144 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -141,12 +141,14 @@ add_RunCMake_test(DisallowedCommands)
add_RunCMake_test(ExternalData)
add_RunCMake_test(FeatureSummary)
add_RunCMake_test(FPHSA)
+add_RunCMake_test(FindBoost)
if(NOT CMAKE_C_COMPILER_ID MATCHES "Watcom")
add_RunCMake_test(GenerateExportHeader)
endif()
add_RunCMake_test(GeneratorExpression)
add_RunCMake_test(GeneratorPlatform)
add_RunCMake_test(GeneratorToolset)
+add_RunCMake_test(GetPrerequisites)
add_RunCMake_test(GNUInstallDirs -DSYSTEM_NAME=${CMAKE_SYSTEM_NAME})
add_RunCMake_test(GoogleTest) # Note: does not actually depend on Google Test
add_RunCMake_test(TargetPropertyGeneratorExpressions)
@@ -227,20 +229,38 @@ add_RunCMake_test(separate_arguments)
add_RunCMake_test(set_property)
add_RunCMake_test(string)
add_RunCMake_test(test_include_dirs)
-foreach(var
- CMAKE_C_COMPILER_ID
- CMAKE_C_COMPILER_VERSION
- CMAKE_C_STANDARD_DEFAULT
- CMAKE_CXX_COMPILER_ID
- CMAKE_CXX_COMPILER_VERSION
- CMAKE_CXX_STANDARD_DEFAULT
- CMake_TEST_CUDA
- )
- if(DEFINED ${var})
- list(APPEND try_compile_ARGS -D${var}=${${var}})
+
+function(add_RunCMake_test_try_compile)
+ if(CMAKE_VERSION VERSION_LESS 3.9.20170907 AND "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
+ # Older CMake versions do not know about MSVC language standards.
+ # Approximate our logic from MSVC-CXX.cmake.
+ if ((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0.24215.1 AND
+ CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.10) OR
+ CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.10.25017)
+ set(CMAKE_CXX_STANDARD_DEFAULT 14)
+ elseif (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.0)
+ set(CMAKE_CXX_STANDARD_DEFAULT "")
+ else()
+ unset(CMAKE_CXX_STANDARD_DEFAULT)
+ endif()
endif()
-endforeach()
-add_RunCMake_test(try_compile)
+ foreach(var
+ CMAKE_C_COMPILER_ID
+ CMAKE_C_COMPILER_VERSION
+ CMAKE_C_STANDARD_DEFAULT
+ CMAKE_CXX_COMPILER_ID
+ CMAKE_CXX_COMPILER_VERSION
+ CMAKE_CXX_STANDARD_DEFAULT
+ CMake_TEST_CUDA
+ )
+ if(DEFINED ${var})
+ list(APPEND try_compile_ARGS -D${var}=${${var}})
+ endif()
+ endforeach()
+ add_RunCMake_test(try_compile)
+endfunction()
+add_RunCMake_test_try_compile()
+
add_RunCMake_test(try_run)
add_RunCMake_test(set)
add_RunCMake_test(variable_watch)
diff --git a/Tests/RunCMake/CPack/DEB/Helpers.cmake b/Tests/RunCMake/CPack/DEB/Helpers.cmake
index ad1b47b..6d8e84a 100644
--- a/Tests/RunCMake/CPack/DEB/Helpers.cmake
+++ b/Tests/RunCMake/CPack/DEB/Helpers.cmake
@@ -23,7 +23,7 @@ function(getPackageNameGlobexpr NAME COMPONENT VERSION REVISION FILE_NO RESULT_V
endif()
if(GENERATOR_SPECIFIC_FORMAT)
- set(${RESULT_VAR} "${NAME}${COMPONENT}_${VERSION}-${REVISION}_*.deb" PARENT_SCOPE)
+ set(${RESULT_VAR} "${NAME}${COMPONENT}_${VERSION}_*.deb" PARENT_SCOPE)
else()
set(${RESULT_VAR} "${NAME}-${VERSION}-*${COMPONENT}.deb" PARENT_SCOPE)
endif()
diff --git a/Tests/RunCMake/CPack/RPM/Helpers.cmake b/Tests/RunCMake/CPack/RPM/Helpers.cmake
index d8012b1..88fc231 100644
--- a/Tests/RunCMake/CPack/RPM/Helpers.cmake
+++ b/Tests/RunCMake/CPack/RPM/Helpers.cmake
@@ -23,6 +23,9 @@ function(getPackageNameGlobexpr NAME COMPONENT VERSION REVISION FILE_NO RESULT_V
endif()
if(GENERATOR_SPECIFIC_FORMAT)
+ if(NOT REVISION)
+ set(REVISION "1")
+ endif()
set(${RESULT_VAR} "${NAME}${COMPONENT}-${VERSION}-${REVISION}.*.rpm" PARENT_SCOPE)
else()
set(${RESULT_VAR} "${NAME}-${VERSION}-*${COMPONENT}.rpm" PARENT_SCOPE)
diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake
index fb1f476..04ac584 100644
--- a/Tests/RunCMake/CPack/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake
@@ -10,6 +10,7 @@ run_cpack_test(DEBUGINFO "RPM" true "COMPONENT")
run_cpack_test(DEPENDENCIES "RPM;DEB" true "COMPONENT")
run_cpack_test(DIST "RPM" false "MONOLITHIC")
run_cpack_test(EMPTY_DIR "RPM;DEB;TGZ" true "MONOLITHIC;COMPONENT")
+run_cpack_test(VERSION "RPM;DEB" false "MONOLITHIC;COMPONENT")
run_cpack_test(EXTRA "DEB" false "COMPONENT")
run_cpack_test(GENERATE_SHLIBS "DEB" true "COMPONENT")
run_cpack_test(GENERATE_SHLIBS_LDCONFIG "DEB" true "COMPONENT")
diff --git a/Tests/RunCMake/CPack/VerifyResult.cmake b/Tests/RunCMake/CPack/VerifyResult.cmake
index 470ebf7..1f5ab87 100644
--- a/Tests/RunCMake/CPack/VerifyResult.cmake
+++ b/Tests/RunCMake/CPack/VerifyResult.cmake
@@ -8,9 +8,7 @@ function(findExpectedFile FILE_NO RESULT_VAR GLOBING_EXPR_VAR)
endif()
if(NOT DEFINED EXPECTED_FILE_${FILE_NO}_VERSION)
set(EXPECTED_FILE_${FILE_NO}_VERSION "0.1.1")
- endif()
- if(NOT DEFINED EXPECTED_FILE_${FILE_NO}_REVISION)
- set(EXPECTED_FILE_${FILE_NO}_REVISION "1")
+ set(EXPECTED_FILE_${FILE_NO}_VERSION "0.1.1" PARENT_SCOPE)
endif()
getPackageNameGlobexpr("${EXPECTED_FILE_${FILE_NO}_NAME}"
diff --git a/Tests/RunCMake/CPack/tests/VERSION/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/VERSION/ExpectedFiles.cmake
new file mode 100644
index 0000000..85c571c
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/VERSION/ExpectedFiles.cmake
@@ -0,0 +1,3 @@
+set(EXPECTED_FILES_COUNT "1")
+set(EXPECTED_FILE_CONTENT_1_LIST "/usr;/usr/foo;/usr/foo/CMakeLists.txt")
+set(EXPECTED_FILE_1_REVISION "1")
diff --git a/Tests/RunCMake/CPack/tests/VERSION/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/VERSION/VerifyResult.cmake
new file mode 100644
index 0000000..eed9696
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/VERSION/VerifyResult.cmake
@@ -0,0 +1,17 @@
+function(checkPackageInfo_ TYPE FILE REGEX)
+ getPackageInfo("${FILE}" "FILE_INFO_")
+ if(NOT FILE_INFO_ MATCHES "${REGEX}")
+ message(FATAL_ERROR "Unexpected ${TYPE} in '${FILE}' ${EXPECTED_FILE_1_VERSION} ${EXPECTED_FILE_1_REVISION}; file info: '${FILE_INFO_}'")
+ endif()
+endfunction()
+
+set(whitespaces_ "[\t\n\r ]*")
+
+if(GENERATOR_TYPE STREQUAL "RPM")
+ checkPackageInfo_("package version" "${FOUND_FILE_1}" "Version${whitespaces_}:${whitespaces_}${EXPECTED_FILE_1_VERSION}")
+ checkPackageInfo_("package revision" "${FOUND_FILE_1}" "Release${whitespaces_}:${whitespaces_}${EXPECTED_FILE_1_REVISION}")
+ checkPackageInfo_("epoch version" "${FOUND_FILE_1}" "Epoch${whitespaces_}:${whitespaces_}3")
+else() # DEB
+ checkPackageInfo_("version" "${FOUND_FILE_1}"
+ ".*Version${whitespaces_}:${whitespaces_}3:${EXPECTED_FILE_1_VERSION}-${EXPECTED_FILE_1_REVISION}")
+endif()
diff --git a/Tests/RunCMake/CPack/tests/VERSION/test.cmake b/Tests/RunCMake/CPack/tests/VERSION/test.cmake
new file mode 100644
index 0000000..301ab61
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/VERSION/test.cmake
@@ -0,0 +1,14 @@
+install(FILES CMakeLists.txt DESTINATION foo COMPONENT test)
+
+if(GENERATOR_TYPE STREQUAL "DEB")
+ set(package_type_ "DEBIAN")
+ set(CPACK_DEBIAN_PACKAGE_RELEASE "1")
+else()
+ set(package_type_ "${GENERATOR_TYPE}")
+endif()
+
+set(CPACK_${package_type_}_PACKAGE_EPOCH "3")
+
+if(PACKAGING_TYPE STREQUAL "COMPONENT")
+ set(CPACK_COMPONENTS_ALL test)
+endif()
diff --git a/Tests/RunCMake/FindBoost/CMakeLists.txt b/Tests/RunCMake/FindBoost/CMakeLists.txt
new file mode 100644
index 0000000..d3137f6
--- /dev/null
+++ b/Tests/RunCMake/FindBoost/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.9)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/FindBoost/CMakePackage-stdout.txt b/Tests/RunCMake/FindBoost/CMakePackage-stdout.txt
new file mode 100644
index 0000000..664e4a5
--- /dev/null
+++ b/Tests/RunCMake/FindBoost/CMakePackage-stdout.txt
@@ -0,0 +1,3 @@
+-- Boost 1\.12345 found\.
+-- Found Boost components:
+ date_time
diff --git a/Tests/RunCMake/FindBoost/CMakePackage.cmake b/Tests/RunCMake/FindBoost/CMakePackage.cmake
new file mode 100644
index 0000000..06aeccb
--- /dev/null
+++ b/Tests/RunCMake/FindBoost/CMakePackage.cmake
@@ -0,0 +1,2 @@
+set(Boost_DIR ${CMAKE_CURRENT_SOURCE_DIR}/CMakePackage)
+find_package(Boost 1.12345 COMPONENTS date_time)
diff --git a/Tests/RunCMake/FindBoost/CMakePackage/BoostConfig.cmake b/Tests/RunCMake/FindBoost/CMakePackage/BoostConfig.cmake
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/FindBoost/CMakePackage/BoostConfig.cmake
diff --git a/Tests/RunCMake/FindBoost/CMakePackage/BoostConfigVersion.cmake b/Tests/RunCMake/FindBoost/CMakePackage/BoostConfigVersion.cmake
new file mode 100644
index 0000000..8176ced
--- /dev/null
+++ b/Tests/RunCMake/FindBoost/CMakePackage/BoostConfigVersion.cmake
@@ -0,0 +1,7 @@
+set(PACKAGE_VERSION 1.12345)
+if(PACKAGE_FIND_VERSION_MAJOR EQUAL 1)
+ set(PACKAGE_VERSION_COMPATIBLE 1)
+ if(PACKAGE_FIND_VERSION_MINOR EQUAL 12345)
+ set(PACKAGE_VERSION_EXACT 1)
+ endif()
+endif()
diff --git a/Tests/RunCMake/FindBoost/RunCMakeTest.cmake b/Tests/RunCMake/FindBoost/RunCMakeTest.cmake
new file mode 100644
index 0000000..a153ae1
--- /dev/null
+++ b/Tests/RunCMake/FindBoost/RunCMakeTest.cmake
@@ -0,0 +1,3 @@
+include(RunCMake)
+
+run_cmake(CMakePackage)
diff --git a/Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake b/Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake
new file mode 100644
index 0000000..3856c54
--- /dev/null
+++ b/Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake
@@ -0,0 +1,3 @@
+include(RunCMake)
+
+run_cmake_command(TargetMissing ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/TargetMissing.cmake)
diff --git a/Tests/RunCMake/GetPrerequisites/TargetMissing-stderr.txt b/Tests/RunCMake/GetPrerequisites/TargetMissing-stderr.txt
new file mode 100644
index 0000000..cffe5f8
--- /dev/null
+++ b/Tests/RunCMake/GetPrerequisites/TargetMissing-stderr.txt
@@ -0,0 +1,3 @@
+^warning: target 'does_not_exist' is not absolute\.\.\.
+warning: target 'does_not_exist' does not exist\.\.\.
+result_var='value;before;call'$
diff --git a/Tests/RunCMake/GetPrerequisites/TargetMissing.cmake b/Tests/RunCMake/GetPrerequisites/TargetMissing.cmake
new file mode 100644
index 0000000..84fd32c
--- /dev/null
+++ b/Tests/RunCMake/GetPrerequisites/TargetMissing.cmake
@@ -0,0 +1,4 @@
+include(GetPrerequisites)
+set(result_var value before call)
+get_prerequisites(does_not_exist result_var 0 0 "" "")
+message("result_var='${result_var}'")
diff --git a/Tests/RunCMake/get_property/source_properties-stderr.txt b/Tests/RunCMake/get_property/source_properties-stderr.txt
index 0a46f96..00a9b82 100644
--- a/Tests/RunCMake/get_property/source_properties-stderr.txt
+++ b/Tests/RunCMake/get_property/source_properties-stderr.txt
@@ -3,4 +3,10 @@ get_property: --><--
get_source_file_property: -->value<--
get_property: -->value<--
get_source_file_property: -->NOTFOUND<--
-get_property: --><--$
+get_property: --><--
+get_source_file_property: -->value<--
+get_property: -->value<--
+get_source_file_property: -->NOTFOUND<--
+get_property: --><--
+get_source_file_property: -->value<--
+get_property: -->value<--$
diff --git a/Tests/RunCMake/get_property/source_properties.cmake b/Tests/RunCMake/get_property/source_properties.cmake
index 263ffe1..12d2d07 100644
--- a/Tests/RunCMake/get_property/source_properties.cmake
+++ b/Tests/RunCMake/get_property/source_properties.cmake
@@ -13,3 +13,13 @@ set_source_files_properties(file.c PROPERTIES empty "" custom value)
check_source_file_property(file.c empty)
check_source_file_property(file.c custom)
check_source_file_property(file.c noexist)
+
+# Test strange legacy behavior in which the order in which source files are
+# first accessed affects how properties are applied without an extension.
+# See also issue #15208.
+get_property(lang SOURCE ${CMAKE_CURRENT_BINARY_DIR}/file2.c PROPERTY LANGUAGE)
+get_property(lang SOURCE ${CMAKE_CURRENT_BINARY_DIR}/file2.h PROPERTY LANGUAGE)
+set_property(SOURCE file2 PROPERTY custom value) # set property without extension
+check_source_file_property(file2 custom) # should have property
+check_source_file_property(file2.h custom) # should not have property
+check_source_file_property(file2.c custom) # should have property
diff --git a/Tests/RunCMake/variable_watch/ModifyWatchInCallback.cmake b/Tests/RunCMake/variable_watch/ModifyWatchInCallback.cmake
new file mode 100644
index 0000000..1dee837
--- /dev/null
+++ b/Tests/RunCMake/variable_watch/ModifyWatchInCallback.cmake
@@ -0,0 +1,17 @@
+function (watch2)
+
+endfunction ()
+
+function (watch1)
+ variable_watch(watched watch2)
+ variable_watch(watched watch2)
+ variable_watch(watched watch2)
+ variable_watch(watched watch2)
+ variable_watch(watched watch2)
+ variable_watch(watched watch2)
+endfunction ()
+
+variable_watch(watched watch1)
+variable_watch(watched watch2)
+
+set(access "${watched}")
diff --git a/Tests/RunCMake/variable_watch/RunCMakeTest.cmake b/Tests/RunCMake/variable_watch/RunCMakeTest.cmake
index 9becb4c..2fa6275 100644
--- a/Tests/RunCMake/variable_watch/RunCMakeTest.cmake
+++ b/Tests/RunCMake/variable_watch/RunCMakeTest.cmake
@@ -3,3 +3,4 @@ include(RunCMake)
run_cmake(ModifiedAccess)
run_cmake(NoWatcher)
run_cmake(WatchTwice)
+run_cmake(ModifyWatchInCallback)
diff --git a/Tests/VSResource/CMakeLists.txt b/Tests/VSResource/CMakeLists.txt
index 718e624..fb47c7e 100644
--- a/Tests/VSResource/CMakeLists.txt
+++ b/Tests/VSResource/CMakeLists.txt
@@ -56,3 +56,10 @@ endif()
set_property(TARGET VSResource
PROPERTY VS_GLOBAL_CMakeTestVsGlobalVariable "test val")
+
+if(CMAKE_GENERATOR MATCHES "Ninja|Visual Studio")
+ cmake_policy(PUSH)
+ cmake_policy(SET CMP0037 OLD)
+ add_library("My ResourceLib" lib.cpp lib.rc)
+ cmake_policy(POP)
+endif()
diff --git a/Tests/VSWinStorePhone/CMakeLists.txt b/Tests/VSWinStorePhone/CMakeLists.txt
index 2b0c478..acda117 100644
--- a/Tests/VSWinStorePhone/CMakeLists.txt
+++ b/Tests/VSWinStorePhone/CMakeLists.txt
@@ -116,12 +116,14 @@ set_property(SOURCE ${RELEASE_CONTENT_FILES} PROPERTY
set_property(SOURCE ${PIXELSHADER_FILES} PROPERTY VS_SHADER_TYPE Pixel)
set_property(SOURCE ${PIXELSHADER_FILES} PROPERTY VS_SHADER_ENTRYPOINT mainPS)
set_property(SOURCE ${PIXELSHADER_FILES} PROPERTY VS_SHADER_MODEL 4.0_level_9_3)
-set_property(SOURCE ${PIXELSHADER_FILES} PROPERTY VS_SHADER_FLAGS "/DFLAGS_ADDED /Fh \"$(OutDir)%(Filename).h\"")
+set_property(SOURCE ${PIXELSHADER_FILES} PROPERTY VS_SHADER_FLAGS "/DFLAGS_ADDED")
+set_property(SOURCE ${PIXELSHADER_FILES} PROPERTY VS_SHADER_OUTPUT_HEADER_FILE "$(OutDir)%(Filename).h")
set_property(SOURCE ${VERTEXSHADER_FILES} PROPERTY VS_SHADER_TYPE Vertex)
set_property(SOURCE ${VERTEXSHADER_FILES} PROPERTY VS_SHADER_ENTRYPOINT mainVS)
set_property(SOURCE ${VERTEXSHADER_FILES} PROPERTY VS_SHADER_MODEL 4.0_level_9_3)
-set_property(SOURCE ${VERTEXSHADER_FILES} PROPERTY VS_SHADER_FLAGS "/DFLAGS_ADDED /Fh \"$(OutDir)%(Filename).h\"")
+set_property(SOURCE ${VERTEXSHADER_FILES} PROPERTY VS_SHADER_FLAGS "/DFLAGS_ADDED")
+set_property(SOURCE ${VERTEXSHADER_FILES} PROPERTY VS_SHADER_OUTPUT_HEADER_FILE "$(OutDir)%(Filename).h")
source_group("Source Files" FILES ${SOURCE_FILES})