summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'Tests')
-rw-r--r--Tests/BootstrapTest.cmake7
-rw-r--r--Tests/CMakeLists.txt1
-rw-r--r--Tests/ExportImport/Export/Interface/CMakeLists.txt26
-rw-r--r--Tests/ExportImport/Export/Interface/headergen.h.in1
-rw-r--r--Tests/ExportImport/Import/Interface/CMakeLists.txt6
-rw-r--r--Tests/ExportImport/Import/Interface/headergentest.cpp11
-rw-r--r--Tests/FindPython/FindPythonScript.cmake2
-rw-r--r--Tests/FindPython/SOABI/CMakeLists.txt16
-rw-r--r--Tests/InterfaceLibrary/CMakeLists.txt1
-rw-r--r--Tests/InterfaceLibrary/definetestexe.cpp6
-rw-r--r--Tests/InterfaceLibrary/headerdir/CMakeLists.txt9
-rw-r--r--Tests/InterfaceLibrary/headerdir/iface_genheader.h.in1
-rw-r--r--Tests/QtAutogen/MocIncludeSymlink/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/CommandLine/RunCMakeTest.cmake8
-rw-r--r--Tests/RunCMake/DependencyGraph/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/DependencyGraph/OptimizeCommon.cmake40
-rw-r--r--Tests/RunCMake/DependencyGraph/OptimizeFortran-both-build-check.cmake5
-rw-r--r--Tests/RunCMake/DependencyGraph/OptimizeFortran-both-build-stderr.txt1
-rw-r--r--Tests/RunCMake/DependencyGraph/OptimizeFortran-both.cmake1
-rw-r--r--Tests/RunCMake/DependencyGraph/OptimizeFortran-middle-build-check.cmake6
-rw-r--r--Tests/RunCMake/DependencyGraph/OptimizeFortran-middle-build-stderr.txt1
-rw-r--r--Tests/RunCMake/DependencyGraph/OptimizeFortran-middle.cmake1
-rw-r--r--Tests/RunCMake/DependencyGraph/OptimizeFortran-none-build-check.cmake6
-rw-r--r--Tests/RunCMake/DependencyGraph/OptimizeFortran-none-build-stderr.txt1
-rw-r--r--Tests/RunCMake/DependencyGraph/OptimizeFortran-none.cmake1
-rw-r--r--Tests/RunCMake/DependencyGraph/OptimizeFortran-top-build-check.cmake5
-rw-r--r--Tests/RunCMake/DependencyGraph/OptimizeFortran-top-build-stderr.txt1
-rw-r--r--Tests/RunCMake/DependencyGraph/OptimizeFortran-top.cmake1
-rw-r--r--Tests/RunCMake/DependencyGraph/OptimizeFortranCommon.cmake25
-rw-r--r--Tests/RunCMake/DependencyGraph/OptimizeShared-both-build-check.cmake11
-rw-r--r--Tests/RunCMake/DependencyGraph/OptimizeShared-both.cmake1
-rw-r--r--Tests/RunCMake/DependencyGraph/OptimizeShared-middle-build-check.cmake11
-rw-r--r--Tests/RunCMake/DependencyGraph/OptimizeShared-middle.cmake1
-rw-r--r--Tests/RunCMake/DependencyGraph/OptimizeShared-none-build-check.cmake11
-rw-r--r--Tests/RunCMake/DependencyGraph/OptimizeShared-none.cmake1
-rw-r--r--Tests/RunCMake/DependencyGraph/OptimizeShared-top-build-check.cmake11
-rw-r--r--Tests/RunCMake/DependencyGraph/OptimizeShared-top.cmake1
-rw-r--r--Tests/RunCMake/DependencyGraph/OptimizeStatic-both-build-check.cmake8
-rw-r--r--Tests/RunCMake/DependencyGraph/OptimizeStatic-both.cmake1
-rw-r--r--Tests/RunCMake/DependencyGraph/OptimizeStatic-middle-build-check.cmake10
-rw-r--r--Tests/RunCMake/DependencyGraph/OptimizeStatic-middle.cmake1
-rw-r--r--Tests/RunCMake/DependencyGraph/OptimizeStatic-none-build-check.cmake10
-rw-r--r--Tests/RunCMake/DependencyGraph/OptimizeStatic-none.cmake1
-rw-r--r--Tests/RunCMake/DependencyGraph/OptimizeStatic-top-build-check.cmake8
-rw-r--r--Tests/RunCMake/DependencyGraph/OptimizeStatic-top.cmake1
-rw-r--r--Tests/RunCMake/DependencyGraph/Property.cmake24
-rw-r--r--Tests/RunCMake/DependencyGraph/RunCMakeTest.cmake60
-rw-r--r--Tests/RunCMake/DependencyGraph/WriteTargets.cmake16
-rw-r--r--Tests/RunCMake/DependencyGraph/mylib.c6
-rw-r--r--Tests/RunCMake/DependencyGraph/mylib.f903
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-check.py6
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/directories/interface.json14
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json1
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json1
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/projects/interface.json13
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_interface.json79
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_top.json4
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json2
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/iface_srcs.json67
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_interface.json70
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2.cmake1
-rw-r--r--Tests/RunCMake/FileAPI/interface/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake5
-rw-r--r--Tests/RunCMake/InterfaceLibrary/ConfigSources.cmake2
-rw-r--r--Tests/RunCMake/InterfaceLibrary/EmptySources-build2-result.txt1
-rw-r--r--Tests/RunCMake/InterfaceLibrary/EmptySources-build2-stdout.txt1
-rw-r--r--Tests/RunCMake/InterfaceLibrary/EmptySources.cmake8
-rw-r--r--Tests/RunCMake/InterfaceLibrary/ExcludeFromAll-build1-check.cmake4
-rw-r--r--Tests/RunCMake/InterfaceLibrary/ExcludeFromAll-build2-check.cmake4
-rw-r--r--Tests/RunCMake/InterfaceLibrary/ExcludeFromAll-build3-result.txt1
-rw-r--r--Tests/RunCMake/InterfaceLibrary/ExcludeFromAll-build3-stdout.txt1
-rw-r--r--Tests/RunCMake/InterfaceLibrary/ExcludeFromAll.cmake7
-rw-r--r--Tests/RunCMake/InterfaceLibrary/PublicSources-build3-result.txt1
-rw-r--r--Tests/RunCMake/InterfaceLibrary/PublicSources-build3-stdout.txt1
-rw-r--r--Tests/RunCMake/InterfaceLibrary/PublicSources.cmake20
-rw-r--r--Tests/RunCMake/InterfaceLibrary/RunCMakeTest.cmake25
-rw-r--r--Tests/RunCMake/InterfaceLibrary/iface.c4
-rw-r--r--Tests/RunCMake/InterfaceLibrary/iface_broken.c1
-rw-r--r--Tests/RunCMake/InterfaceLibrary/invalid_signature-stderr.txt15
-rw-r--r--Tests/RunCMake/InterfaceLibrary/invalid_signature.cmake6
-rw-r--r--Tests/RunCMake/InterfaceLibrary/use_iface.c6
-rw-r--r--Tests/RunCMake/InterfaceLibrary/whitelist-result.txt1
-rw-r--r--Tests/RunCMake/InterfaceLibrary/whitelist-stderr.txt19
-rw-r--r--Tests/RunCMake/InterfaceLibrary/whitelist.cmake25
-rw-r--r--Tests/RunCMake/Make/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/VS10Project/InterfaceLibSources-check.cmake25
-rw-r--r--Tests/RunCMake/VS10Project/InterfaceLibSources.cmake1
-rw-r--r--Tests/RunCMake/VS10Project/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/VS10Project/iface.h0
-rw-r--r--Tests/RunCMake/XcodeProject/InterfaceLibSources-check.cmake16
-rw-r--r--Tests/RunCMake/XcodeProject/InterfaceLibSources.cmake1
-rw-r--r--Tests/RunCMake/XcodeProject/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/XcodeProject/iface.h0
-rw-r--r--Tests/RunCMake/ctest_memcheck/DummyCudaMemcheck-stderr.txt2
-rw-r--r--Tests/RunCMake/ctest_memcheck/DummyCudaMemcheck-stdout.txt3
-rw-r--r--Tests/RunCMake/ctest_memcheck/testCudaMemcheck.cmake15
97 files changed, 803 insertions, 76 deletions
diff --git a/Tests/BootstrapTest.cmake b/Tests/BootstrapTest.cmake
index 07a65bf..137de78 100644
--- a/Tests/BootstrapTest.cmake
+++ b/Tests/BootstrapTest.cmake
@@ -1,12 +1,15 @@
file(MAKE_DIRECTORY "${bin_dir}")
include(ProcessorCount)
ProcessorCount(nproc)
+if(generator MATCHES "Ninja")
+ set(ninja_arg --generator=Ninja)
+endif()
if(NOT nproc EQUAL 0)
set(parallel_arg --parallel=${nproc})
endif()
-message(STATUS "running bootstrap: ${bootstrap} ${parallel_arg}")
+message(STATUS "running bootstrap: ${bootstrap} ${ninja_arg} ${parallel_arg}")
execute_process(
- COMMAND ${bootstrap} ${parallel_arg}
+ COMMAND ${bootstrap} ${ninja_arg} ${parallel_arg}
WORKING_DIRECTORY "${bin_dir}"
RESULT_VARIABLE result
)
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 4a774dd..e4e09fa 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -3240,6 +3240,7 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH
COMMAND ${CMAKE_CMAKE_COMMAND}
-D "bootstrap=${bootstrap}"
-D "bin_dir=${CMake_BINARY_DIR}/Tests/BootstrapTest"
+ -D "generator=${CMAKE_GENERATOR}"
-P ${CMAKE_CURRENT_SOURCE_DIR}/BootstrapTest.cmake
)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BootstrapTest")
diff --git a/Tests/ExportImport/Export/Interface/CMakeLists.txt b/Tests/ExportImport/Export/Interface/CMakeLists.txt
index 43b7217..ba2164b 100644
--- a/Tests/ExportImport/Export/Interface/CMakeLists.txt
+++ b/Tests/ExportImport/Export/Interface/CMakeLists.txt
@@ -1,11 +1,26 @@
-
-add_library(headeronly INTERFACE)
+set(headeronly_headers headeronly/headeronly.h)
+add_library(headeronly INTERFACE ${headeronly_headers})
set_property(TARGET headeronly PROPERTY INTERFACE_INCLUDE_DIRECTORIES
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/headeronly>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/include/headeronly>"
)
set_property(TARGET headeronly PROPERTY INTERFACE_COMPILE_DEFINITIONS "HEADERONLY_DEFINE")
+add_custom_command(OUTPUT headergen/headergen.h
+ COMMAND ${CMAKE_COMMAND} -E copy
+ ${CMAKE_CURRENT_SOURCE_DIR}/headergen.h.in
+ ${CMAKE_CURRENT_BINARY_DIR}/headergen/headergen.h
+ DEPENDS
+ ${CMAKE_CURRENT_SOURCE_DIR}/headergen.h.in
+ VERBATIM)
+
+add_library(headergen INTERFACE headergen/headergen.h)
+set_property(TARGET headergen PROPERTY INTERFACE_INCLUDE_DIRECTORIES
+ "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/headergen>"
+)
+set_property(TARGET headergen PROPERTY PUBLIC_HEADER
+ ${CMAKE_CURRENT_BINARY_DIR}/headergen/headergen.h)
+
add_library(pch_iface INTERFACE)
target_precompile_headers(pch_iface INTERFACE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/pch/pch.h>"
@@ -54,6 +69,11 @@ install(TARGETS headeronly sharediface use_auto_type use_c_restrict source_targe
pch_iface cmakeonly
EXPORT expInterface
)
+install(TARGETS headergen
+ EXPORT expInterface
+ PUBLIC_HEADER DESTINATION include/headergen
+ INCLUDES DESTINATION include/headergen
+)
install(TARGETS sharedlib
EXPORT expInterface
RUNTIME DESTINATION bin
@@ -63,7 +83,7 @@ install(TARGETS sharedlib
BUNDLE DESTINATION Applications
)
install(FILES
- headeronly/headeronly.h
+ ${headeronly_headers}
DESTINATION include/headeronly
)
install(FILES
diff --git a/Tests/ExportImport/Export/Interface/headergen.h.in b/Tests/ExportImport/Export/Interface/headergen.h.in
new file mode 100644
index 0000000..bda2b81
--- /dev/null
+++ b/Tests/ExportImport/Export/Interface/headergen.h.in
@@ -0,0 +1 @@
+#define HEADERGEN_H
diff --git a/Tests/ExportImport/Import/Interface/CMakeLists.txt b/Tests/ExportImport/Import/Interface/CMakeLists.txt
index ef666b1..202c23e 100644
--- a/Tests/ExportImport/Import/Interface/CMakeLists.txt
+++ b/Tests/ExportImport/Import/Interface/CMakeLists.txt
@@ -12,6 +12,9 @@ set_property(TARGET define_iface PROPERTY
add_executable(headeronlytest_bld headeronlytest.cpp)
target_link_libraries(headeronlytest_bld bld::headeronly)
+add_executable(headergentest_bld headergentest.cpp)
+target_link_libraries(headergentest_bld bld::headergen)
+
set_property(TARGET bld::sharediface APPEND PROPERTY INTERFACE_LINK_LIBRARIES define_iface)
add_executable(interfacetest_bld interfacetest.cpp)
@@ -93,6 +96,9 @@ target_compile_definitions(source_target_test_exp PRIVATE USE_FROM_INSTALL_DIR)
add_executable(headeronlytest_exp headeronlytest.cpp)
target_link_libraries(headeronlytest_exp exp::headeronly)
+add_executable(headergentest_exp headergentest.cpp)
+target_link_libraries(headergentest_exp exp::headergen)
+
set_property(TARGET exp::sharediface APPEND PROPERTY INTERFACE_LINK_LIBRARIES define_iface)
add_executable(interfacetest_exp interfacetest.cpp)
diff --git a/Tests/ExportImport/Import/Interface/headergentest.cpp b/Tests/ExportImport/Import/Interface/headergentest.cpp
new file mode 100644
index 0000000..88ff7f1
--- /dev/null
+++ b/Tests/ExportImport/Import/Interface/headergentest.cpp
@@ -0,0 +1,11 @@
+
+#include "headergen.h"
+
+#ifndef HEADERGEN_H
+# error Expected HEADERGEN_H
+#endif
+
+int main()
+{
+ return 0;
+}
diff --git a/Tests/FindPython/FindPythonScript.cmake b/Tests/FindPython/FindPythonScript.cmake
index bc7e0d1..808496e 100644
--- a/Tests/FindPython/FindPythonScript.cmake
+++ b/Tests/FindPython/FindPythonScript.cmake
@@ -1,4 +1,4 @@
-
+cmake_minimum_required(VERSION 3.12)
if (PYTHON_MUST_NOT_BE_FOUND)
find_package(${PYTHON_PACKAGE_NAME} QUIET)
if (${PYTHON_PACKAGE_NAME}_FOUND)
diff --git a/Tests/FindPython/SOABI/CMakeLists.txt b/Tests/FindPython/SOABI/CMakeLists.txt
index 4a6aea3..36daa9f 100644
--- a/Tests/FindPython/SOABI/CMakeLists.txt
+++ b/Tests/FindPython/SOABI/CMakeLists.txt
@@ -20,3 +20,19 @@ if (Python3_Development_FOUND AND Python3_SOABI)
message(FATAL_ERROR "Module suffix do not include Python3_SOABI")
endif()
endif()
+
+
+find_package(Python2 COMPONENTS ${CMake_TEST_FindPython_COMPONENT})
+if(NOT DEFINED Python2_SOABI)
+ message(FATAL_ERROR "Python2_SOABI for ${CMake_TEST_FindPython_COMPONENT} not found")
+endif()
+
+if (Python2_Development_FOUND AND Python2_SOABI)
+ Python2_add_library (spam2 MODULE WITH_SOABI ../spam.c)
+ target_compile_definitions (spam2 PRIVATE PYTHON2)
+
+ get_property (suffix TARGET spam2 PROPERTY SUFFIX)
+ if (NOT suffix MATCHES "^.${Python2_SOABI}")
+ message(FATAL_ERROR "Module suffix do not include Python2_SOABI")
+ endif()
+endif()
diff --git a/Tests/InterfaceLibrary/CMakeLists.txt b/Tests/InterfaceLibrary/CMakeLists.txt
index 311ca2a..ec0a604 100644
--- a/Tests/InterfaceLibrary/CMakeLists.txt
+++ b/Tests/InterfaceLibrary/CMakeLists.txt
@@ -44,6 +44,7 @@ add_executable(InterfaceLibrary definetestexe.cpp)
target_link_libraries(InterfaceLibrary
iface_nodepends
headeriface
+ iface_genheader
subiface
intermediate
diff --git a/Tests/InterfaceLibrary/definetestexe.cpp b/Tests/InterfaceLibrary/definetestexe.cpp
index 9156426..6c53840 100644
--- a/Tests/InterfaceLibrary/definetestexe.cpp
+++ b/Tests/InterfaceLibrary/definetestexe.cpp
@@ -15,6 +15,12 @@
# error Expected IFACE_HEADER_BUILDDIR
#endif
+#include "iface_genheader.h"
+
+#ifndef IFACE_GENHEADER
+# error Expected IFACE_GENHEADER
+#endif
+
extern int obj();
extern int sub();
extern int item();
diff --git a/Tests/InterfaceLibrary/headerdir/CMakeLists.txt b/Tests/InterfaceLibrary/headerdir/CMakeLists.txt
index 826a9ed..ae030d7 100644
--- a/Tests/InterfaceLibrary/headerdir/CMakeLists.txt
+++ b/Tests/InterfaceLibrary/headerdir/CMakeLists.txt
@@ -11,3 +11,12 @@ add_custom_target(headeriface_gen
VERBATIM
)
add_dependencies(headeriface headeriface_gen)
+
+add_custom_command(OUTPUT iface_genheader.h
+ COMMAND ${CMAKE_COMMAND} -E copy
+ ${CMAKE_CURRENT_SOURCE_DIR}/iface_genheader.h.in
+ ${CMAKE_CURRENT_BINARY_DIR}/iface_genheader.h
+ DEPENDS
+ ${CMAKE_CURRENT_SOURCE_DIR}/iface_genheader.h.in
+ VERBATIM)
+add_library(iface_genheader INTERFACE iface_genheader.h)
diff --git a/Tests/InterfaceLibrary/headerdir/iface_genheader.h.in b/Tests/InterfaceLibrary/headerdir/iface_genheader.h.in
new file mode 100644
index 0000000..0a21b62
--- /dev/null
+++ b/Tests/InterfaceLibrary/headerdir/iface_genheader.h.in
@@ -0,0 +1 @@
+#define IFACE_GENHEADER
diff --git a/Tests/QtAutogen/MocIncludeSymlink/CMakeLists.txt b/Tests/QtAutogen/MocIncludeSymlink/CMakeLists.txt
index 1627b39..8b11b46 100644
--- a/Tests/QtAutogen/MocIncludeSymlink/CMakeLists.txt
+++ b/Tests/QtAutogen/MocIncludeSymlink/CMakeLists.txt
@@ -61,6 +61,7 @@ macro(buildMocInclude sourceDir binaryDir)
"${sourceDir}"
MocInclude
CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
+ "-DCMAKE_AUTOMOC_PATH_PREFIX=ON"
"-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}"
"-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
OUTPUT_VARIABLE output
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index e08b30a..98a1f87 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -401,6 +401,7 @@ add_RunCMake_test(no_install_prefix)
add_RunCMake_test(configure_file)
add_RunCMake_test(CTestTimeout -DTIMEOUT=${CTestTestTimeout_TIME})
add_RunCMake_test(CTestTimeoutAfterMatch)
+add_RunCMake_test(DependencyGraph -DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER})
# ctresalloc links against CMakeLib and CTestLib, which means it can't be built
# if CMake_TEST_EXTERNAL_CMAKE is activated (the compiler might be different.)
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index b20e683..2a5d5d3 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -779,15 +779,15 @@ function(run_llvm_rc)
file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
run_cmake_command(llvm_rc_no_args ${CMAKE_COMMAND} -E cmake_llvm_rc)
run_cmake_command(llvm_rc_no_-- ${CMAKE_COMMAND} -E cmake_llvm_rc ${RunCMake_TEST_BINARY_DIR}/source_file test.tmp ${CMAKE_COMMAND} -E echo "This is a test")
- run_cmake_command(llvm_rc_empty_preprocessor ${CMAKE_COMMAND} -E cmake_llvm_rc ${RunCMake_TEST_BINARY_DIR}/source_file test.tmp -- ${CMAKE_COMMAND} -E echo "This is a test")
- run_cmake_command(llvm_rc_failing_first_command ${CMAKE_COMMAND} -E cmake_llvm_rc ${RunCMake_TEST_BINARY_DIR}/source_file test.tmp ${CMAKE_COMMAND} -P FailedProgram.cmake -- ${CMAKE_COMMAND} -E echo "This is a test")
- run_cmake_command(llvm_rc_failing_second_command ${CMAKE_COMMAND} -E cmake_llvm_rc ${RunCMake_TEST_BINARY_DIR}/source_file test.tmp ${CMAKE_COMMAND} -E echo "This is a test" -- ${CMAKE_COMMAND} -P FailedProgram.cmake )
+ run_cmake_command(llvm_rc_empty_preprocessor ${CMAKE_COMMAND} -E cmake_llvm_rc ${RunCMake_TEST_BINARY_DIR}/source_file test.tmp ++ ${CMAKE_COMMAND} -E echo "This is a test")
+ run_cmake_command(llvm_rc_failing_first_command ${CMAKE_COMMAND} -E cmake_llvm_rc ${RunCMake_TEST_BINARY_DIR}/source_file test.tmp ${CMAKE_COMMAND} -P FailedProgram.cmake ++ ${CMAKE_COMMAND} -E echo "This is a test")
+ run_cmake_command(llvm_rc_failing_second_command ${CMAKE_COMMAND} -E cmake_llvm_rc ${RunCMake_TEST_BINARY_DIR}/source_file test.tmp ${CMAKE_COMMAND} -E echo "This is a test" ++ ${CMAKE_COMMAND} -P FailedProgram.cmake )
if(EXISTS ${RunCMake_TEST_BINARY_DIR}/test.tmp)
message(SEND_ERROR "${test} - FAILED:\n"
"test.tmp was not deleted")
endif()
file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}/ExpandSourceDir")
- run_cmake_command(llvm_rc_full_run ${CMAKE_COMMAND} -E cmake_llvm_rc ${RunCMake_TEST_BINARY_DIR}/ExpandSourceDir/source_file test.tmp ${CMAKE_COMMAND} -E echo "This is a test" -- ${CMAKE_COMMAND} -E copy test.tmp SOURCE_DIR/llvmrc.result )
+ run_cmake_command(llvm_rc_full_run ${CMAKE_COMMAND} -E cmake_llvm_rc ${RunCMake_TEST_BINARY_DIR}/ExpandSourceDir/source_file test.tmp ${CMAKE_COMMAND} -E echo "This is a test" ++ ${CMAKE_COMMAND} -E copy test.tmp SOURCE_DIR/llvmrc.result )
if(EXISTS ${RunCMake_TEST_BINARY_DIR}/ExpandSourceDir/test.tmp)
message(SEND_ERROR "${test} - FAILED:\n"
"test.tmp was not deleted")
diff --git a/Tests/RunCMake/DependencyGraph/CMakeLists.txt b/Tests/RunCMake/DependencyGraph/CMakeLists.txt
new file mode 100644
index 0000000..b646c4a
--- /dev/null
+++ b/Tests/RunCMake/DependencyGraph/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.18)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/DependencyGraph/OptimizeCommon.cmake b/Tests/RunCMake/DependencyGraph/OptimizeCommon.cmake
new file mode 100644
index 0000000..4954bc4
--- /dev/null
+++ b/Tests/RunCMake/DependencyGraph/OptimizeCommon.cmake
@@ -0,0 +1,40 @@
+enable_language(C)
+
+set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY out)
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY out)
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY out)
+
+add_library(SharedTop SHARED mylib.c)
+add_library(StaticTop STATIC mylib.c)
+add_library(StaticMiddle STATIC mylib.c)
+
+add_library(StaticNone STATIC mylib.c)
+add_library(StaticPreBuild STATIC mylib.c)
+add_library(StaticPreLink STATIC mylib.c)
+add_library(StaticPostBuild STATIC mylib.c)
+add_library(StaticCc STATIC mylibcc.c)
+
+add_custom_command(TARGET StaticPreBuild PRE_BUILD
+ COMMAND ${CMAKE_COMMAND} -E true)
+add_custom_command(TARGET StaticPreLink PRE_LINK
+ COMMAND ${CMAKE_COMMAND} -E true)
+add_custom_command(TARGET StaticPostBuild POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E true)
+add_custom_command(OUTPUT mylibcc.c
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/mylib.c ${CMAKE_BINARY_DIR}/mylibcc.c)
+
+target_link_libraries(SharedTop PRIVATE StaticMiddle)
+target_link_libraries(StaticTop PRIVATE StaticMiddle)
+target_link_libraries(StaticMiddle PRIVATE StaticNone StaticPreBuild StaticPreLink StaticPostBuild StaticCc)
+
+if(OPTIMIZE_TOP)
+ set_target_properties(SharedTop StaticTop PROPERTIES
+ OPTIMIZE_DEPENDENCIES TRUE)
+endif()
+if(OPTIMIZE_MIDDLE)
+ set_target_properties(StaticMiddle PROPERTIES
+ OPTIMIZE_DEPENDENCIES TRUE)
+endif()
+
+include(WriteTargets.cmake)
+write_targets()
diff --git a/Tests/RunCMake/DependencyGraph/OptimizeFortran-both-build-check.cmake b/Tests/RunCMake/DependencyGraph/OptimizeFortran-both-build-check.cmake
new file mode 100644
index 0000000..1020cb3
--- /dev/null
+++ b/Tests/RunCMake/DependencyGraph/OptimizeFortran-both-build-check.cmake
@@ -0,0 +1,5 @@
+include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake)
+check_files(${RunCMake_TEST_BINARY_DIR}/out
+ ${FortranTop_TARGET_FILE}
+ ${FortranBottom_TARGET_FILE}
+ )
diff --git a/Tests/RunCMake/DependencyGraph/OptimizeFortran-both-build-stderr.txt b/Tests/RunCMake/DependencyGraph/OptimizeFortran-both-build-stderr.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/DependencyGraph/OptimizeFortran-both-build-stderr.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/DependencyGraph/OptimizeFortran-both.cmake b/Tests/RunCMake/DependencyGraph/OptimizeFortran-both.cmake
new file mode 100644
index 0000000..581fd46
--- /dev/null
+++ b/Tests/RunCMake/DependencyGraph/OptimizeFortran-both.cmake
@@ -0,0 +1 @@
+include(OptimizeFortranCommon.cmake)
diff --git a/Tests/RunCMake/DependencyGraph/OptimizeFortran-middle-build-check.cmake b/Tests/RunCMake/DependencyGraph/OptimizeFortran-middle-build-check.cmake
new file mode 100644
index 0000000..5c7e8cd
--- /dev/null
+++ b/Tests/RunCMake/DependencyGraph/OptimizeFortran-middle-build-check.cmake
@@ -0,0 +1,6 @@
+include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake)
+check_files(${RunCMake_TEST_BINARY_DIR}/out
+ ${FortranTop_TARGET_FILE}
+ ${CMiddle_TARGET_FILE}
+ ${FortranBottom_TARGET_FILE}
+ )
diff --git a/Tests/RunCMake/DependencyGraph/OptimizeFortran-middle-build-stderr.txt b/Tests/RunCMake/DependencyGraph/OptimizeFortran-middle-build-stderr.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/DependencyGraph/OptimizeFortran-middle-build-stderr.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/DependencyGraph/OptimizeFortran-middle.cmake b/Tests/RunCMake/DependencyGraph/OptimizeFortran-middle.cmake
new file mode 100644
index 0000000..581fd46
--- /dev/null
+++ b/Tests/RunCMake/DependencyGraph/OptimizeFortran-middle.cmake
@@ -0,0 +1 @@
+include(OptimizeFortranCommon.cmake)
diff --git a/Tests/RunCMake/DependencyGraph/OptimizeFortran-none-build-check.cmake b/Tests/RunCMake/DependencyGraph/OptimizeFortran-none-build-check.cmake
new file mode 100644
index 0000000..5c7e8cd
--- /dev/null
+++ b/Tests/RunCMake/DependencyGraph/OptimizeFortran-none-build-check.cmake
@@ -0,0 +1,6 @@
+include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake)
+check_files(${RunCMake_TEST_BINARY_DIR}/out
+ ${FortranTop_TARGET_FILE}
+ ${CMiddle_TARGET_FILE}
+ ${FortranBottom_TARGET_FILE}
+ )
diff --git a/Tests/RunCMake/DependencyGraph/OptimizeFortran-none-build-stderr.txt b/Tests/RunCMake/DependencyGraph/OptimizeFortran-none-build-stderr.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/DependencyGraph/OptimizeFortran-none-build-stderr.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/DependencyGraph/OptimizeFortran-none.cmake b/Tests/RunCMake/DependencyGraph/OptimizeFortran-none.cmake
new file mode 100644
index 0000000..581fd46
--- /dev/null
+++ b/Tests/RunCMake/DependencyGraph/OptimizeFortran-none.cmake
@@ -0,0 +1 @@
+include(OptimizeFortranCommon.cmake)
diff --git a/Tests/RunCMake/DependencyGraph/OptimizeFortran-top-build-check.cmake b/Tests/RunCMake/DependencyGraph/OptimizeFortran-top-build-check.cmake
new file mode 100644
index 0000000..1020cb3
--- /dev/null
+++ b/Tests/RunCMake/DependencyGraph/OptimizeFortran-top-build-check.cmake
@@ -0,0 +1,5 @@
+include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake)
+check_files(${RunCMake_TEST_BINARY_DIR}/out
+ ${FortranTop_TARGET_FILE}
+ ${FortranBottom_TARGET_FILE}
+ )
diff --git a/Tests/RunCMake/DependencyGraph/OptimizeFortran-top-build-stderr.txt b/Tests/RunCMake/DependencyGraph/OptimizeFortran-top-build-stderr.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/DependencyGraph/OptimizeFortran-top-build-stderr.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/DependencyGraph/OptimizeFortran-top.cmake b/Tests/RunCMake/DependencyGraph/OptimizeFortran-top.cmake
new file mode 100644
index 0000000..581fd46
--- /dev/null
+++ b/Tests/RunCMake/DependencyGraph/OptimizeFortran-top.cmake
@@ -0,0 +1 @@
+include(OptimizeFortranCommon.cmake)
diff --git a/Tests/RunCMake/DependencyGraph/OptimizeFortranCommon.cmake b/Tests/RunCMake/DependencyGraph/OptimizeFortranCommon.cmake
new file mode 100644
index 0000000..354d3fc
--- /dev/null
+++ b/Tests/RunCMake/DependencyGraph/OptimizeFortranCommon.cmake
@@ -0,0 +1,25 @@
+enable_language(C)
+enable_language(Fortran)
+
+set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY out)
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY out)
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY out)
+
+add_library(FortranTop STATIC mylib.f90)
+add_library(CMiddle STATIC mylib.c)
+add_library(FortranBottom STATIC mylib.f90)
+
+target_link_libraries(FortranTop PRIVATE CMiddle)
+target_link_libraries(CMiddle PRIVATE FortranBottom)
+
+if(OPTIMIZE_TOP)
+ set_target_properties(FortranTop PROPERTIES
+ OPTIMIZE_DEPENDENCIES TRUE)
+endif()
+if(OPTIMIZE_MIDDLE)
+ set_target_properties(CMiddle PROPERTIES
+ OPTIMIZE_DEPENDENCIES TRUE)
+endif()
+
+include(WriteTargets.cmake)
+write_targets()
diff --git a/Tests/RunCMake/DependencyGraph/OptimizeShared-both-build-check.cmake b/Tests/RunCMake/DependencyGraph/OptimizeShared-both-build-check.cmake
new file mode 100644
index 0000000..312de04
--- /dev/null
+++ b/Tests/RunCMake/DependencyGraph/OptimizeShared-both-build-check.cmake
@@ -0,0 +1,11 @@
+include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake)
+check_files(${RunCMake_TEST_BINARY_DIR}/out
+ ${SharedTop_TARGET_FILE}
+ ${SharedTop_TARGET_LINKER_FILE}
+ ${StaticMiddle_TARGET_FILE}
+ ${StaticNone_TARGET_FILE}
+ ${StaticPreBuild_TARGET_FILE}
+ ${StaticPreLink_TARGET_FILE}
+ ${StaticPostBuild_TARGET_FILE}
+ ${StaticCc_TARGET_FILE}
+ )
diff --git a/Tests/RunCMake/DependencyGraph/OptimizeShared-both.cmake b/Tests/RunCMake/DependencyGraph/OptimizeShared-both.cmake
new file mode 100644
index 0000000..c150e62
--- /dev/null
+++ b/Tests/RunCMake/DependencyGraph/OptimizeShared-both.cmake
@@ -0,0 +1 @@
+include(OptimizeCommon.cmake)
diff --git a/Tests/RunCMake/DependencyGraph/OptimizeShared-middle-build-check.cmake b/Tests/RunCMake/DependencyGraph/OptimizeShared-middle-build-check.cmake
new file mode 100644
index 0000000..312de04
--- /dev/null
+++ b/Tests/RunCMake/DependencyGraph/OptimizeShared-middle-build-check.cmake
@@ -0,0 +1,11 @@
+include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake)
+check_files(${RunCMake_TEST_BINARY_DIR}/out
+ ${SharedTop_TARGET_FILE}
+ ${SharedTop_TARGET_LINKER_FILE}
+ ${StaticMiddle_TARGET_FILE}
+ ${StaticNone_TARGET_FILE}
+ ${StaticPreBuild_TARGET_FILE}
+ ${StaticPreLink_TARGET_FILE}
+ ${StaticPostBuild_TARGET_FILE}
+ ${StaticCc_TARGET_FILE}
+ )
diff --git a/Tests/RunCMake/DependencyGraph/OptimizeShared-middle.cmake b/Tests/RunCMake/DependencyGraph/OptimizeShared-middle.cmake
new file mode 100644
index 0000000..c150e62
--- /dev/null
+++ b/Tests/RunCMake/DependencyGraph/OptimizeShared-middle.cmake
@@ -0,0 +1 @@
+include(OptimizeCommon.cmake)
diff --git a/Tests/RunCMake/DependencyGraph/OptimizeShared-none-build-check.cmake b/Tests/RunCMake/DependencyGraph/OptimizeShared-none-build-check.cmake
new file mode 100644
index 0000000..312de04
--- /dev/null
+++ b/Tests/RunCMake/DependencyGraph/OptimizeShared-none-build-check.cmake
@@ -0,0 +1,11 @@
+include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake)
+check_files(${RunCMake_TEST_BINARY_DIR}/out
+ ${SharedTop_TARGET_FILE}
+ ${SharedTop_TARGET_LINKER_FILE}
+ ${StaticMiddle_TARGET_FILE}
+ ${StaticNone_TARGET_FILE}
+ ${StaticPreBuild_TARGET_FILE}
+ ${StaticPreLink_TARGET_FILE}
+ ${StaticPostBuild_TARGET_FILE}
+ ${StaticCc_TARGET_FILE}
+ )
diff --git a/Tests/RunCMake/DependencyGraph/OptimizeShared-none.cmake b/Tests/RunCMake/DependencyGraph/OptimizeShared-none.cmake
new file mode 100644
index 0000000..c150e62
--- /dev/null
+++ b/Tests/RunCMake/DependencyGraph/OptimizeShared-none.cmake
@@ -0,0 +1 @@
+include(OptimizeCommon.cmake)
diff --git a/Tests/RunCMake/DependencyGraph/OptimizeShared-top-build-check.cmake b/Tests/RunCMake/DependencyGraph/OptimizeShared-top-build-check.cmake
new file mode 100644
index 0000000..312de04
--- /dev/null
+++ b/Tests/RunCMake/DependencyGraph/OptimizeShared-top-build-check.cmake
@@ -0,0 +1,11 @@
+include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake)
+check_files(${RunCMake_TEST_BINARY_DIR}/out
+ ${SharedTop_TARGET_FILE}
+ ${SharedTop_TARGET_LINKER_FILE}
+ ${StaticMiddle_TARGET_FILE}
+ ${StaticNone_TARGET_FILE}
+ ${StaticPreBuild_TARGET_FILE}
+ ${StaticPreLink_TARGET_FILE}
+ ${StaticPostBuild_TARGET_FILE}
+ ${StaticCc_TARGET_FILE}
+ )
diff --git a/Tests/RunCMake/DependencyGraph/OptimizeShared-top.cmake b/Tests/RunCMake/DependencyGraph/OptimizeShared-top.cmake
new file mode 100644
index 0000000..c150e62
--- /dev/null
+++ b/Tests/RunCMake/DependencyGraph/OptimizeShared-top.cmake
@@ -0,0 +1 @@
+include(OptimizeCommon.cmake)
diff --git a/Tests/RunCMake/DependencyGraph/OptimizeStatic-both-build-check.cmake b/Tests/RunCMake/DependencyGraph/OptimizeStatic-both-build-check.cmake
new file mode 100644
index 0000000..5222ed7
--- /dev/null
+++ b/Tests/RunCMake/DependencyGraph/OptimizeStatic-both-build-check.cmake
@@ -0,0 +1,8 @@
+include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake)
+check_files(${RunCMake_TEST_BINARY_DIR}/out
+ ${StaticTop_TARGET_FILE}
+ ${StaticPreBuild_TARGET_FILE}
+ ${StaticPreLink_TARGET_FILE}
+ ${StaticPostBuild_TARGET_FILE}
+ ${StaticCc_TARGET_FILE}
+ )
diff --git a/Tests/RunCMake/DependencyGraph/OptimizeStatic-both.cmake b/Tests/RunCMake/DependencyGraph/OptimizeStatic-both.cmake
new file mode 100644
index 0000000..c150e62
--- /dev/null
+++ b/Tests/RunCMake/DependencyGraph/OptimizeStatic-both.cmake
@@ -0,0 +1 @@
+include(OptimizeCommon.cmake)
diff --git a/Tests/RunCMake/DependencyGraph/OptimizeStatic-middle-build-check.cmake b/Tests/RunCMake/DependencyGraph/OptimizeStatic-middle-build-check.cmake
new file mode 100644
index 0000000..5cba223
--- /dev/null
+++ b/Tests/RunCMake/DependencyGraph/OptimizeStatic-middle-build-check.cmake
@@ -0,0 +1,10 @@
+include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake)
+check_files(${RunCMake_TEST_BINARY_DIR}/out
+ ${StaticTop_TARGET_FILE}
+ ${StaticMiddle_TARGET_FILE}
+ ${StaticNone_TARGET_FILE}
+ ${StaticPreBuild_TARGET_FILE}
+ ${StaticPreLink_TARGET_FILE}
+ ${StaticPostBuild_TARGET_FILE}
+ ${StaticCc_TARGET_FILE}
+ )
diff --git a/Tests/RunCMake/DependencyGraph/OptimizeStatic-middle.cmake b/Tests/RunCMake/DependencyGraph/OptimizeStatic-middle.cmake
new file mode 100644
index 0000000..c150e62
--- /dev/null
+++ b/Tests/RunCMake/DependencyGraph/OptimizeStatic-middle.cmake
@@ -0,0 +1 @@
+include(OptimizeCommon.cmake)
diff --git a/Tests/RunCMake/DependencyGraph/OptimizeStatic-none-build-check.cmake b/Tests/RunCMake/DependencyGraph/OptimizeStatic-none-build-check.cmake
new file mode 100644
index 0000000..5cba223
--- /dev/null
+++ b/Tests/RunCMake/DependencyGraph/OptimizeStatic-none-build-check.cmake
@@ -0,0 +1,10 @@
+include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake)
+check_files(${RunCMake_TEST_BINARY_DIR}/out
+ ${StaticTop_TARGET_FILE}
+ ${StaticMiddle_TARGET_FILE}
+ ${StaticNone_TARGET_FILE}
+ ${StaticPreBuild_TARGET_FILE}
+ ${StaticPreLink_TARGET_FILE}
+ ${StaticPostBuild_TARGET_FILE}
+ ${StaticCc_TARGET_FILE}
+ )
diff --git a/Tests/RunCMake/DependencyGraph/OptimizeStatic-none.cmake b/Tests/RunCMake/DependencyGraph/OptimizeStatic-none.cmake
new file mode 100644
index 0000000..c150e62
--- /dev/null
+++ b/Tests/RunCMake/DependencyGraph/OptimizeStatic-none.cmake
@@ -0,0 +1 @@
+include(OptimizeCommon.cmake)
diff --git a/Tests/RunCMake/DependencyGraph/OptimizeStatic-top-build-check.cmake b/Tests/RunCMake/DependencyGraph/OptimizeStatic-top-build-check.cmake
new file mode 100644
index 0000000..5222ed7
--- /dev/null
+++ b/Tests/RunCMake/DependencyGraph/OptimizeStatic-top-build-check.cmake
@@ -0,0 +1,8 @@
+include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake)
+check_files(${RunCMake_TEST_BINARY_DIR}/out
+ ${StaticTop_TARGET_FILE}
+ ${StaticPreBuild_TARGET_FILE}
+ ${StaticPreLink_TARGET_FILE}
+ ${StaticPostBuild_TARGET_FILE}
+ ${StaticCc_TARGET_FILE}
+ )
diff --git a/Tests/RunCMake/DependencyGraph/OptimizeStatic-top.cmake b/Tests/RunCMake/DependencyGraph/OptimizeStatic-top.cmake
new file mode 100644
index 0000000..c150e62
--- /dev/null
+++ b/Tests/RunCMake/DependencyGraph/OptimizeStatic-top.cmake
@@ -0,0 +1 @@
+include(OptimizeCommon.cmake)
diff --git a/Tests/RunCMake/DependencyGraph/Property.cmake b/Tests/RunCMake/DependencyGraph/Property.cmake
new file mode 100644
index 0000000..08fdd2b
--- /dev/null
+++ b/Tests/RunCMake/DependencyGraph/Property.cmake
@@ -0,0 +1,24 @@
+enable_language(C)
+
+add_library(Unset STATIC mylib.c)
+
+set(CMAKE_OPTIMIZE_DEPENDENCIES TRUE)
+add_library(SetTrue STATIC mylib.c)
+
+set(CMAKE_OPTIMIZE_DEPENDENCIES FALSE)
+add_library(SetFalse STATIC mylib.c)
+
+get_property(_set TARGET Unset PROPERTY OPTIMIZE_DEPENDENCIES SET)
+if(_set)
+ message(SEND_ERROR "OPTIMIZE_DEPENDENCIES property should not be set on Unset target")
+endif()
+
+get_property(_true TARGET SetTrue PROPERTY OPTIMIZE_DEPENDENCIES)
+if(NOT _true STREQUAL "TRUE")
+ message(SEND_ERROR "OPTIMIZE_DEPENDENCIES property should be TRUE on SetTrue target")
+endif()
+
+get_property(_false TARGET SetFalse PROPERTY OPTIMIZE_DEPENDENCIES)
+if(NOT _false STREQUAL "FALSE")
+ message(SEND_ERROR "OPTIMIZE_DEPENDENCIES property should be FALSE on SetFalse target")
+endif()
diff --git a/Tests/RunCMake/DependencyGraph/RunCMakeTest.cmake b/Tests/RunCMake/DependencyGraph/RunCMakeTest.cmake
new file mode 100644
index 0000000..cb0d541
--- /dev/null
+++ b/Tests/RunCMake/DependencyGraph/RunCMakeTest.cmake
@@ -0,0 +1,60 @@
+include(RunCMake)
+
+function(check_files dir)
+ set(expected ${ARGN})
+ list(FILTER expected EXCLUDE REGEX "^$")
+ list(REMOVE_DUPLICATES expected)
+ list(SORT expected)
+
+ file(GLOB_RECURSE glob "${dir}/*")
+ set(actual)
+ foreach(i IN LISTS glob)
+ if(NOT i MATCHES "(\\.manifest$)|(\\.exp$)|(\\.tds$)")
+ list(APPEND actual ${i})
+ endif()
+ endforeach()
+ list(REMOVE_DUPLICATES actual)
+ list(SORT actual)
+
+ if(NOT "${expected}" STREQUAL "${actual}")
+ string(REPLACE ";" "\n " expected_formatted "${expected}")
+ string(REPLACE ";" "\n " actual_formatted "${actual}")
+ string(APPEND RunCMake_TEST_FAILED "Actual files did not match expected\nExpected:\n ${expected_formatted}\nActual:\n ${actual_formatted}\n")
+ endif()
+
+ set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE)
+endfunction()
+
+function(run_cmake_build name)
+ set(RunCMake_TEST_NO_CLEAN TRUE)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${name}-build)
+ file(REMOVE_RECURSE ${RunCMake_TEST_BINARY_DIR})
+ if(NOT RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Release)
+ endif()
+ run_cmake(${name})
+ set(RunCMake_TEST_OPTIONS)
+ run_cmake_command(${name}-build ${CMAKE_COMMAND}
+ --build ${RunCMake_TEST_BINARY_DIR}
+ --config Release
+ --target ${ARGN})
+endfunction()
+
+function(run_optimize_test name)
+ set(RunCMake_TEST_OPTIONS)
+ run_cmake_build(${name}-none ${ARGN})
+ set(RunCMake_TEST_OPTIONS -DOPTIMIZE_TOP=TRUE)
+ run_cmake_build(${name}-top ${ARGN})
+ set(RunCMake_TEST_OPTIONS -DOPTIMIZE_MIDDLE=TRUE)
+ run_cmake_build(${name}-middle ${ARGN})
+ set(RunCMake_TEST_OPTIONS -DOPTIMIZE_TOP=TRUE -DOPTIMIZE_MIDDLE=TRUE)
+ run_cmake_build(${name}-both ${ARGN})
+endfunction()
+
+run_cmake(Property)
+
+run_optimize_test(OptimizeShared SharedTop)
+run_optimize_test(OptimizeStatic StaticTop)
+if(CMAKE_Fortran_COMPILER)
+ run_optimize_test(OptimizeFortran FortranTop)
+endif()
diff --git a/Tests/RunCMake/DependencyGraph/WriteTargets.cmake b/Tests/RunCMake/DependencyGraph/WriteTargets.cmake
new file mode 100644
index 0000000..e1012c1
--- /dev/null
+++ b/Tests/RunCMake/DependencyGraph/WriteTargets.cmake
@@ -0,0 +1,16 @@
+function(write_targets)
+ set(_input "")
+
+ get_property(_targets DIRECTORY . PROPERTY BUILDSYSTEM_TARGETS)
+ foreach(_t IN LISTS _targets)
+ get_property(_type TARGET "${_t}" PROPERTY TYPE)
+ if(_type STREQUAL "SHARED_LIBRARY")
+ string(APPEND _input "set(${_t}_TARGET_FILE [==[$<TARGET_FILE:${_t}>]==])\n")
+ string(APPEND _input "set(${_t}_TARGET_LINKER_FILE [==[$<TARGET_LINKER_FILE:${_t}>]==])\n")
+ elseif(_type STREQUAL "STATIC_LIBRARY")
+ string(APPEND _input "set(${_t}_TARGET_FILE [==[$<TARGET_FILE:${_t}>]==])\n")
+ endif()
+ endforeach()
+
+ file(GENERATE OUTPUT target_files.cmake CONTENT "${_input}" CONDITION $<CONFIG:Release>)
+endfunction()
diff --git a/Tests/RunCMake/DependencyGraph/mylib.c b/Tests/RunCMake/DependencyGraph/mylib.c
new file mode 100644
index 0000000..5422fe3
--- /dev/null
+++ b/Tests/RunCMake/DependencyGraph/mylib.c
@@ -0,0 +1,6 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+ void mylib(void)
+{
+}
diff --git a/Tests/RunCMake/DependencyGraph/mylib.f90 b/Tests/RunCMake/DependencyGraph/mylib.f90
new file mode 100644
index 0000000..104768f
--- /dev/null
+++ b/Tests/RunCMake/DependencyGraph/mylib.f90
@@ -0,0 +1,3 @@
+function mylib_fortran()
+ mylib_fortran = 42
+end function mylib_fortran
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-check.py b/Tests/RunCMake/FileAPI/codemodel-v2-check.py
index b567bf1..c66757f 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-check.py
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-check.py
@@ -522,6 +522,7 @@ def gen_check_directories(c, g):
read_codemodel_json_data("directories/custom.json"),
read_codemodel_json_data("directories/cxx.json"),
read_codemodel_json_data("directories/imported.json"),
+ read_codemodel_json_data("directories/interface.json"),
read_codemodel_json_data("directories/object.json"),
read_codemodel_json_data("directories/dir.json"),
read_codemodel_json_data("directories/dir_dir.json"),
@@ -594,6 +595,10 @@ def gen_check_targets(c, g, inSource):
read_codemodel_json_data("targets/link_imported_object_exe.json"),
read_codemodel_json_data("targets/link_imported_interface_exe.json"),
+ read_codemodel_json_data("targets/all_build_interface.json"),
+ read_codemodel_json_data("targets/zero_check_interface.json"),
+ read_codemodel_json_data("targets/iface_srcs.json"),
+
read_codemodel_json_data("targets/all_build_custom.json"),
read_codemodel_json_data("targets/zero_check_custom.json"),
read_codemodel_json_data("targets/custom_tgt.json"),
@@ -722,6 +727,7 @@ def gen_check_projects(c, g):
read_codemodel_json_data("projects/alias.json"),
read_codemodel_json_data("projects/object.json"),
read_codemodel_json_data("projects/imported.json"),
+ read_codemodel_json_data("projects/interface.json"),
read_codemodel_json_data("projects/custom.json"),
read_codemodel_json_data("projects/external.json"),
]
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/interface.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/interface.json
new file mode 100644
index 0000000..b10d496
--- /dev/null
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/interface.json
@@ -0,0 +1,14 @@
+{
+ "source": "^interface$",
+ "build": "^interface$",
+ "parentSource": "^\\.$",
+ "childSources": null,
+ "targetIds": [
+ "^ALL_BUILD::@25b7fa8ea00134654b85$",
+ "^ZERO_CHECK::@25b7fa8ea00134654b85$",
+ "^iface_srcs::@25b7fa8ea00134654b85$"
+ ],
+ "projectName": "Interface",
+ "minimumCMakeVersion": "3.12",
+ "hasInstallRule": null
+}
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json
index c144953..736d1f5 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json
@@ -7,6 +7,7 @@
"^custom$",
"^cxx$",
"^imported$",
+ "^interface$",
"^object$",
"^.*/Tests/RunCMake/FileAPIExternalSource$",
"^dir$"
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json
index f3aac63..4d0cdc0 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/codemodel-v2.json
@@ -6,6 +6,7 @@
"Custom",
"Cxx",
"Imported",
+ "Interface",
"Object",
"External"
],
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/interface.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/interface.json
new file mode 100644
index 0000000..2a22767
--- /dev/null
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/projects/interface.json
@@ -0,0 +1,13 @@
+{
+ "name": "Interface",
+ "parentName": "codemodel-v2",
+ "childNames": null,
+ "directorySources": [
+ "^interface$"
+ ],
+ "targetIds": [
+ "^ALL_BUILD::@25b7fa8ea00134654b85$",
+ "^ZERO_CHECK::@25b7fa8ea00134654b85$",
+ "^iface_srcs::@25b7fa8ea00134654b85$"
+ ]
+}
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_interface.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_interface.json
new file mode 100644
index 0000000..fa2a6e5
--- /dev/null
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_interface.json
@@ -0,0 +1,79 @@
+{
+ "name": "ALL_BUILD",
+ "id": "^ALL_BUILD::@25b7fa8ea00134654b85$",
+ "directorySource": "^interface$",
+ "projectName": "Interface",
+ "type": "UTILITY",
+ "isGeneratorProvided": true,
+ "sources": [
+ {
+ "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/interface/CMakeFiles/ALL_BUILD$",
+ "isGenerated": true,
+ "sourceGroupName": "",
+ "compileGroupLanguage": null,
+ "backtrace": [
+ {
+ "file": "^interface/CMakeLists\\.txt$",
+ "line": null,
+ "command": null,
+ "hasParent": false
+ }
+ ]
+ },
+ {
+ "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/interface/CMakeFiles/ALL_BUILD\\.rule$",
+ "isGenerated": true,
+ "sourceGroupName": "CMake Rules",
+ "compileGroupLanguage": null,
+ "backtrace": [
+ {
+ "file": "^interface/CMakeLists\\.txt$",
+ "line": null,
+ "command": null,
+ "hasParent": false
+ }
+ ]
+ }
+ ],
+ "sourceGroups": [
+ {
+ "name": "",
+ "sourcePaths": [
+ "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/interface/CMakeFiles/ALL_BUILD$"
+ ]
+ },
+ {
+ "name": "CMake Rules",
+ "sourcePaths": [
+ "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/interface/CMakeFiles/ALL_BUILD\\.rule$"
+ ]
+ }
+ ],
+ "compileGroups": null,
+ "backtrace": [
+ {
+ "file": "^interface/CMakeLists\\.txt$",
+ "line": null,
+ "command": null,
+ "hasParent": false
+ }
+ ],
+ "folder": null,
+ "nameOnDisk": null,
+ "artifacts": null,
+ "build": "^interface$",
+ "source": "^interface$",
+ "install": null,
+ "link": null,
+ "archive": null,
+ "dependencies": [
+ {
+ "id": "^ZERO_CHECK::@25b7fa8ea00134654b85$",
+ "backtrace": null
+ },
+ {
+ "id": "^iface_srcs::@25b7fa8ea00134654b85$",
+ "backtrace": null
+ }
+ ]
+}
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_top.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_top.json
index 59bd750..d023f99 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_top.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/all_build_top.json
@@ -176,6 +176,10 @@
"backtrace": null
},
{
+ "id": "^iface_srcs::@25b7fa8ea00134654b85$",
+ "backtrace": null
+ },
+ {
"id": "^custom_exe::@c11385ffed57b860da63$",
"backtrace": null
},
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json
index e7ab55b..c9e652b 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json
@@ -119,7 +119,7 @@
"backtrace": [
{
"file": "^codemodel-v2\\.cmake$",
- "line": 37,
+ "line": 38,
"command": "install",
"hasParent": true
},
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/iface_srcs.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/iface_srcs.json
new file mode 100644
index 0000000..97d7ccd
--- /dev/null
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/iface_srcs.json
@@ -0,0 +1,67 @@
+{
+ "name": "iface_srcs",
+ "id": "^iface_srcs::@25b7fa8ea00134654b85$",
+ "directorySource": "^interface$",
+ "projectName": "Interface",
+ "type": "INTERFACE_LIBRARY",
+ "isGeneratorProvided": null,
+ "sources": [
+ {
+ "path": "^empty\\.c$",
+ "isGenerated": null,
+ "sourceGroupName": "Source Files",
+ "compileGroupLanguage": null,
+ "backtrace": [
+ {
+ "file": "^interface/CMakeLists\\.txt$",
+ "line": 3,
+ "command": "add_library",
+ "hasParent": true
+ },
+ {
+ "file": "^interface/CMakeLists\\.txt$",
+ "line": null,
+ "command": null,
+ "hasParent": false
+ }
+ ]
+ }
+ ],
+ "sourceGroups": [
+ {
+ "name": "Source Files",
+ "sourcePaths": [
+ "^empty\\.c$"
+ ]
+ }
+ ],
+ "compileGroups": null,
+ "backtrace": [
+ {
+ "file": "^interface/CMakeLists\\.txt$",
+ "line": 3,
+ "command": "add_library",
+ "hasParent": true
+ },
+ {
+ "file": "^interface/CMakeLists\\.txt$",
+ "line": null,
+ "command": null,
+ "hasParent": false
+ }
+ ],
+ "folder": null,
+ "nameOnDisk": null,
+ "artifacts": null,
+ "build": "^interface$",
+ "source": "^interface$",
+ "install": null,
+ "link": null,
+ "archive": null,
+ "dependencies": [
+ {
+ "id": "^ZERO_CHECK::@25b7fa8ea00134654b85$",
+ "backtrace": null
+ }
+ ]
+}
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_interface.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_interface.json
new file mode 100644
index 0000000..fdd4b2a
--- /dev/null
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/zero_check_interface.json
@@ -0,0 +1,70 @@
+{
+ "name": "ZERO_CHECK",
+ "id": "^ZERO_CHECK::@25b7fa8ea00134654b85$",
+ "directorySource": "^interface$",
+ "projectName": "Interface",
+ "type": "UTILITY",
+ "isGeneratorProvided": true,
+ "sources": [
+ {
+ "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/interface/CMakeFiles/ZERO_CHECK$",
+ "isGenerated": true,
+ "sourceGroupName": "",
+ "compileGroupLanguage": null,
+ "backtrace": [
+ {
+ "file": "^interface/CMakeLists\\.txt$",
+ "line": null,
+ "command": null,
+ "hasParent": false
+ }
+ ]
+ },
+ {
+ "path": "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/interface/CMakeFiles/ZERO_CHECK\\.rule$",
+ "isGenerated": true,
+ "sourceGroupName": "CMake Rules",
+ "compileGroupLanguage": null,
+ "backtrace": [
+ {
+ "file": "^interface/CMakeLists\\.txt$",
+ "line": null,
+ "command": null,
+ "hasParent": false
+ }
+ ]
+ }
+ ],
+ "sourceGroups": [
+ {
+ "name": "",
+ "sourcePaths": [
+ "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/interface/CMakeFiles/ZERO_CHECK$"
+ ]
+ },
+ {
+ "name": "CMake Rules",
+ "sourcePaths": [
+ "^.*/Tests/RunCMake/FileAPI/codemodel-v2-build/interface/CMakeFiles/ZERO_CHECK\\.rule$"
+ ]
+ }
+ ],
+ "compileGroups": null,
+ "backtrace": [
+ {
+ "file": "^interface/CMakeLists\\.txt$",
+ "line": null,
+ "command": null,
+ "hasParent": false
+ }
+ ],
+ "folder": null,
+ "nameOnDisk": null,
+ "artifacts": null,
+ "build": "^interface$",
+ "source": "^interface$",
+ "install": null,
+ "link": null,
+ "archive": null,
+ "dependencies": null
+}
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2.cmake b/Tests/RunCMake/FileAPI/codemodel-v2.cmake
index c98a84c..2405954 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2.cmake
+++ b/Tests/RunCMake/FileAPI/codemodel-v2.cmake
@@ -18,6 +18,7 @@ add_subdirectory(cxx)
add_subdirectory(alias)
add_subdirectory(object)
add_subdirectory(imported)
+add_subdirectory(interface)
add_subdirectory(custom)
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../FileAPIExternalSource" "${CMAKE_CURRENT_BINARY_DIR}/../FileAPIExternalBuild")
add_subdirectory(dir)
diff --git a/Tests/RunCMake/FileAPI/interface/CMakeLists.txt b/Tests/RunCMake/FileAPI/interface/CMakeLists.txt
new file mode 100644
index 0000000..97948c5
--- /dev/null
+++ b/Tests/RunCMake/FileAPI/interface/CMakeLists.txt
@@ -0,0 +1,3 @@
+project(Interface)
+add_library(iface_none INTERFACE)
+add_library(iface_srcs INTERFACE ../empty.c)
diff --git a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake
index dc77915..4e6eef6 100644
--- a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake
+++ b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake
@@ -1,5 +1,10 @@
include(RunCMake)
+# Isolate test cases from caller's environment.
+set(ENV{CMAKE_PREFIX_PATH} "")
+set(ENV{CMAKE_APPBUNDLE_PATH} "")
+set(ENV{CMAKE_FRAMEWORK_PATH} "")
+
run_cmake(PkgConfigDoesNotExist)
run_cmake(FindPkgConfig_NO_PKGCONFIG_PATH)
diff --git a/Tests/RunCMake/InterfaceLibrary/ConfigSources.cmake b/Tests/RunCMake/InterfaceLibrary/ConfigSources.cmake
new file mode 100644
index 0000000..631a845
--- /dev/null
+++ b/Tests/RunCMake/InterfaceLibrary/ConfigSources.cmake
@@ -0,0 +1,2 @@
+# Test an interface library added to the build system by a per-config source.
+add_library(iface INTERFACE $<$<CONFIG:NotAConfig>:${CMAKE_CURRENT_SOURCE_DIR}/iface.c>)
diff --git a/Tests/RunCMake/InterfaceLibrary/EmptySources-build2-result.txt b/Tests/RunCMake/InterfaceLibrary/EmptySources-build2-result.txt
new file mode 100644
index 0000000..d197c91
--- /dev/null
+++ b/Tests/RunCMake/InterfaceLibrary/EmptySources-build2-result.txt
@@ -0,0 +1 @@
+[^0]
diff --git a/Tests/RunCMake/InterfaceLibrary/EmptySources-build2-stdout.txt b/Tests/RunCMake/InterfaceLibrary/EmptySources-build2-stdout.txt
new file mode 100644
index 0000000..aac9172
--- /dev/null
+++ b/Tests/RunCMake/InterfaceLibrary/EmptySources-build2-stdout.txt
@@ -0,0 +1 @@
+iface2|Invalid project
diff --git a/Tests/RunCMake/InterfaceLibrary/EmptySources.cmake b/Tests/RunCMake/InterfaceLibrary/EmptySources.cmake
new file mode 100644
index 0000000..f452394
--- /dev/null
+++ b/Tests/RunCMake/InterfaceLibrary/EmptySources.cmake
@@ -0,0 +1,8 @@
+# Test an interface library added to the build system by empty SOURCES.
+add_library(iface INTERFACE)
+set_property(TARGET iface PROPERTY SOURCES "")
+
+# ...but not added by unset SOURCES.
+add_library(iface2 INTERFACE)
+set_property(TARGET iface2 PROPERTY SOURCES "")
+set_property(TARGET iface2 PROPERTY SOURCES)
diff --git a/Tests/RunCMake/InterfaceLibrary/ExcludeFromAll-build1-check.cmake b/Tests/RunCMake/InterfaceLibrary/ExcludeFromAll-build1-check.cmake
new file mode 100644
index 0000000..6500e48
--- /dev/null
+++ b/Tests/RunCMake/InterfaceLibrary/ExcludeFromAll-build1-check.cmake
@@ -0,0 +1,4 @@
+if(EXISTS "${RunCMake_TEST_BINARY_DIR}/iface.txt")
+ set(RunCMake_TEST_FAILED "iface target built as part of 'all'")
+ return()
+endif()
diff --git a/Tests/RunCMake/InterfaceLibrary/ExcludeFromAll-build2-check.cmake b/Tests/RunCMake/InterfaceLibrary/ExcludeFromAll-build2-check.cmake
new file mode 100644
index 0000000..0977c24
--- /dev/null
+++ b/Tests/RunCMake/InterfaceLibrary/ExcludeFromAll-build2-check.cmake
@@ -0,0 +1,4 @@
+if(NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/iface.txt")
+ set(RunCMake_TEST_FAILED "iface target not built")
+ return()
+endif()
diff --git a/Tests/RunCMake/InterfaceLibrary/ExcludeFromAll-build3-result.txt b/Tests/RunCMake/InterfaceLibrary/ExcludeFromAll-build3-result.txt
new file mode 100644
index 0000000..d197c91
--- /dev/null
+++ b/Tests/RunCMake/InterfaceLibrary/ExcludeFromAll-build3-result.txt
@@ -0,0 +1 @@
+[^0]
diff --git a/Tests/RunCMake/InterfaceLibrary/ExcludeFromAll-build3-stdout.txt b/Tests/RunCMake/InterfaceLibrary/ExcludeFromAll-build3-stdout.txt
new file mode 100644
index 0000000..aac9172
--- /dev/null
+++ b/Tests/RunCMake/InterfaceLibrary/ExcludeFromAll-build3-stdout.txt
@@ -0,0 +1 @@
+iface2|Invalid project
diff --git a/Tests/RunCMake/InterfaceLibrary/ExcludeFromAll.cmake b/Tests/RunCMake/InterfaceLibrary/ExcludeFromAll.cmake
new file mode 100644
index 0000000..714161d
--- /dev/null
+++ b/Tests/RunCMake/InterfaceLibrary/ExcludeFromAll.cmake
@@ -0,0 +1,7 @@
+# Test an interface library with a custom command, but excluded from all.
+add_custom_command(OUTPUT iface.txt COMMAND ${CMAKE_COMMAND} -E touch iface.txt)
+add_library(iface INTERFACE EXCLUDE_FROM_ALL iface.txt)
+
+# Test that EXCLUDE_FROM_ALL is allowed even if the interface library has
+# no sources, and does not cause it to appear in the build system.
+add_library(iface2 INTERFACE EXCLUDE_FROM_ALL)
diff --git a/Tests/RunCMake/InterfaceLibrary/PublicSources-build3-result.txt b/Tests/RunCMake/InterfaceLibrary/PublicSources-build3-result.txt
new file mode 100644
index 0000000..d197c91
--- /dev/null
+++ b/Tests/RunCMake/InterfaceLibrary/PublicSources-build3-result.txt
@@ -0,0 +1 @@
+[^0]
diff --git a/Tests/RunCMake/InterfaceLibrary/PublicSources-build3-stdout.txt b/Tests/RunCMake/InterfaceLibrary/PublicSources-build3-stdout.txt
new file mode 100644
index 0000000..aac9172
--- /dev/null
+++ b/Tests/RunCMake/InterfaceLibrary/PublicSources-build3-stdout.txt
@@ -0,0 +1 @@
+iface2|Invalid project
diff --git a/Tests/RunCMake/InterfaceLibrary/PublicSources.cmake b/Tests/RunCMake/InterfaceLibrary/PublicSources.cmake
new file mode 100644
index 0000000..24785bb
--- /dev/null
+++ b/Tests/RunCMake/InterfaceLibrary/PublicSources.cmake
@@ -0,0 +1,20 @@
+cmake_policy(SET CMP0076 NEW)
+enable_language(C)
+
+# Test that an interface library can have PUBLIC sources.
+# This causes the target to appear in the build system
+# *and* causes consumers to use the source.
+add_library(iface INTERFACE)
+target_sources(iface
+ PUBLIC iface.c
+ # Private sources do not compile here or propagate.
+ PRIVATE iface_broken.c
+ )
+
+# Test that an intermediate interface library does not get the
+# sources and does not appear in the build system.
+add_library(iface2 INTERFACE)
+target_link_libraries(iface2 INTERFACE iface)
+
+add_executable(use_iface use_iface.c)
+target_link_libraries(use_iface PRIVATE iface2)
diff --git a/Tests/RunCMake/InterfaceLibrary/RunCMakeTest.cmake b/Tests/RunCMake/InterfaceLibrary/RunCMakeTest.cmake
index 5a6af1d..834b3c8 100644
--- a/Tests/RunCMake/InterfaceLibrary/RunCMakeTest.cmake
+++ b/Tests/RunCMake/InterfaceLibrary/RunCMakeTest.cmake
@@ -3,7 +3,6 @@ include(RunCMake)
run_cmake(invalid_name)
run_cmake(target_commands)
run_cmake(no_shared_libs)
-run_cmake(whitelist)
run_cmake(invalid_signature)
run_cmake(global-interface)
run_cmake(genex_link)
@@ -11,3 +10,27 @@ run_cmake(add_custom_command-TARGET)
run_cmake(IMPORTED_LIBNAME-bad-value)
run_cmake(IMPORTED_LIBNAME-non-iface)
run_cmake(IMPORTED_LIBNAME-non-imported)
+
+function(run_WithSources CASE)
+ if(NOT RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug)
+ endif()
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${CASE}-build)
+ run_cmake(${CASE})
+ set(RunCMake_TEST_NO_CLEAN 1)
+ foreach(build IN LISTS ARGN)
+ if(build MATCHES "^([^:]+)$")
+ run_cmake_command(${CASE}-${CMAKE_MATCH_1} ${CMAKE_COMMAND} --build . --config Debug)
+ elseif(build MATCHES "^([^:]+):([^:,]+)(,merge)?$")
+ if(CMAKE_MATCH_3 STREQUAL ",merge")
+ set(RunCMake_TEST_OUTPUT_MERGE 1)
+ endif()
+ run_cmake_command(${CASE}-${CMAKE_MATCH_1} ${CMAKE_COMMAND} --build . --config Debug --target ${CMAKE_MATCH_2})
+ endif()
+ endforeach()
+endfunction()
+
+run_WithSources(ConfigSources "build1:iface")
+run_WithSources(EmptySources "build1:iface" "build2:iface2,merge")
+run_WithSources(ExcludeFromAll "build1" "build2:iface" "build3:iface2,merge")
+run_WithSources(PublicSources "build1" "build2:iface" "build3:iface2,merge")
diff --git a/Tests/RunCMake/InterfaceLibrary/iface.c b/Tests/RunCMake/InterfaceLibrary/iface.c
new file mode 100644
index 0000000..c7e7372
--- /dev/null
+++ b/Tests/RunCMake/InterfaceLibrary/iface.c
@@ -0,0 +1,4 @@
+int iface(void)
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/InterfaceLibrary/iface_broken.c b/Tests/RunCMake/InterfaceLibrary/iface_broken.c
new file mode 100644
index 0000000..4ff7f31
--- /dev/null
+++ b/Tests/RunCMake/InterfaceLibrary/iface_broken.c
@@ -0,0 +1 @@
+#error This file should not compile
diff --git a/Tests/RunCMake/InterfaceLibrary/invalid_signature-stderr.txt b/Tests/RunCMake/InterfaceLibrary/invalid_signature-stderr.txt
index 6374b33..763f9f8 100644
--- a/Tests/RunCMake/InterfaceLibrary/invalid_signature-stderr.txt
+++ b/Tests/RunCMake/InterfaceLibrary/invalid_signature-stderr.txt
@@ -1,8 +1,3 @@
-CMake Error at invalid_signature.cmake:2 \(add_library\):
- add_library INTERFACE library requires no source arguments.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
-+
CMake Error at invalid_signature.cmake:3 \(add_library\):
add_library INTERFACE library specified with conflicting/multiple types.
Call Stack \(most recent call first\):
@@ -73,16 +68,6 @@ CMake Error at invalid_signature.cmake:16 \(add_library\):
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
+
-CMake Error at invalid_signature.cmake:17 \(add_library\):
- add_library INTERFACE library may not be used with EXCLUDE_FROM_ALL.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
-+
-CMake Error at invalid_signature.cmake:18 \(add_library\):
- add_library INTERFACE library may not be used with EXCLUDE_FROM_ALL.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
-+
CMake Error at invalid_signature.cmake:20 \(add_library\):
add_library GLOBAL option may only be used with IMPORTED libraries.
Call Stack \(most recent call first\):
diff --git a/Tests/RunCMake/InterfaceLibrary/invalid_signature.cmake b/Tests/RunCMake/InterfaceLibrary/invalid_signature.cmake
index 4e53534..2a575b5 100644
--- a/Tests/RunCMake/InterfaceLibrary/invalid_signature.cmake
+++ b/Tests/RunCMake/InterfaceLibrary/invalid_signature.cmake
@@ -1,5 +1,5 @@
-add_library(iface1 INTERFACE empty.cpp)
+
add_library(iface3 STATIC INTERFACE)
add_library(iface4 STATIC INTERFACE empty.cpp)
add_library(iface5 SHARED INTERFACE)
@@ -14,7 +14,7 @@ add_library(iface13 INTERFACE UNKNOWN)
add_library(iface14 INTERFACE ALIAS)
add_library(iface15 ALIAS INTERFACE)
add_library(iface16 INTERFACE INTERFACE)
-add_library(iface17 INTERFACE EXCLUDE_FROM_ALL)
-add_library(iface18 EXCLUDE_FROM_ALL INTERFACE)
+
+
# add_library(iface19 GLOBAL INTERFACE) Tested separately
add_library(iface20 INTERFACE GLOBAL)
diff --git a/Tests/RunCMake/InterfaceLibrary/use_iface.c b/Tests/RunCMake/InterfaceLibrary/use_iface.c
new file mode 100644
index 0000000..66293e4
--- /dev/null
+++ b/Tests/RunCMake/InterfaceLibrary/use_iface.c
@@ -0,0 +1,6 @@
+extern int iface(void);
+
+int main(void)
+{
+ return iface();
+}
diff --git a/Tests/RunCMake/InterfaceLibrary/whitelist-result.txt b/Tests/RunCMake/InterfaceLibrary/whitelist-result.txt
deleted file mode 100644
index d00491f..0000000
--- a/Tests/RunCMake/InterfaceLibrary/whitelist-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-1
diff --git a/Tests/RunCMake/InterfaceLibrary/whitelist-stderr.txt b/Tests/RunCMake/InterfaceLibrary/whitelist-stderr.txt
deleted file mode 100644
index 577c0cc..0000000
--- a/Tests/RunCMake/InterfaceLibrary/whitelist-stderr.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-CMake Error at whitelist.cmake:4 \(set_property\):
- INTERFACE_LIBRARY targets may only have whitelisted properties. The
- property "OUTPUT_NAME" is not allowed.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
-
-
-CMake Error at whitelist.cmake:5 \(set_property\):
- INTERFACE_LIBRARY targets may only have whitelisted properties. The
- property "OUTPUT_NAME" is not allowed.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
-
-
-CMake Error at whitelist.cmake:6 \(get_target_property\):
- INTERFACE_LIBRARY targets may only have whitelisted properties. The
- property "OUTPUT_NAME" is not allowed.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/InterfaceLibrary/whitelist.cmake b/Tests/RunCMake/InterfaceLibrary/whitelist.cmake
deleted file mode 100644
index 0db6375..0000000
--- a/Tests/RunCMake/InterfaceLibrary/whitelist.cmake
+++ /dev/null
@@ -1,25 +0,0 @@
-
-add_library(iface INTERFACE)
-
-set_property(TARGET iface PROPERTY OUTPUT_NAME output)
-set_property(TARGET iface APPEND PROPERTY OUTPUT_NAME append)
-get_target_property(outname iface OUTPUT_NAME)
-
-# Properties starting with `_` are allowed.
-set_property(TARGET iface PROPERTY "_custom_property" output)
-set_property(TARGET iface APPEND PROPERTY "_custom_property" append)
-get_target_property(outname iface "_custom_property")
-
-# Properties starting with a lowercase letter are allowed.
-set_property(TARGET iface PROPERTY "custom_property" output)
-set_property(TARGET iface APPEND PROPERTY "custom_property" append)
-get_target_property(outname iface "custom_property")
-
-# PUBLIC_HEADER / PRIVATE_HEADER properties are allowed
-set_property(TARGET iface PROPERTY PUBLIC_HEADER foo.h)
-set_property(TARGET iface APPEND PROPERTY PUBLIC_HEADER bar.h)
-get_target_property(outname iface PUBLIC_HEADER)
-
-set_property(TARGET iface PROPERTY PRIVATE_HEADER foo.h)
-set_property(TARGET iface APPEND PROPERTY PRIVATE_HEADER bar.h)
-get_target_property(outname iface PRIVATE_HEADER)
diff --git a/Tests/RunCMake/Make/RunCMakeTest.cmake b/Tests/RunCMake/Make/RunCMakeTest.cmake
index 6b2721c..32aafca 100644
--- a/Tests/RunCMake/Make/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Make/RunCMakeTest.cmake
@@ -27,12 +27,15 @@ function(run_VerboseBuild)
run_cmake_command(VerboseBuild-build ${CMAKE_COMMAND} --build . -v --clean-first)
unset(RunCMake-stdout-file)
set(_backup_lang "$ENV{LANG}")
+ set(_backup_lc_Messages "$ENV{LC_MESSAGES}")
if(MAKE_IS_GNU)
set(RunCMake-stdout-file VerboseBuild-nowork-gnu-stdout.txt)
set(ENV{LANG} "C")
+ set(ENV{LC_MESSAGES} "C")
endif()
run_cmake_command(VerboseBuild-nowork ${CMAKE_COMMAND} --build . --verbose)
set(ENV{LANG} "${_backup_lang}")
+ set(ENV{LC_MESSAGES} "${_backup_lc_messages}")
endfunction()
run_VerboseBuild()
diff --git a/Tests/RunCMake/VS10Project/InterfaceLibSources-check.cmake b/Tests/RunCMake/VS10Project/InterfaceLibSources-check.cmake
new file mode 100644
index 0000000..bcdc101
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/InterfaceLibSources-check.cmake
@@ -0,0 +1,25 @@
+set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/iface.vcxproj")
+if(NOT EXISTS "${vcProjectFile}")
+ set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.")
+ return()
+endif()
+
+set(found_iface_h 0)
+file(STRINGS "${vcProjectFile}" lines)
+foreach(line IN LISTS lines)
+ if(line MATCHES "<([A-Za-z0-9_]+) +Include=.*iface\\.h")
+ set(rule "${CMAKE_MATCH_1}")
+ if(NOT rule STREQUAL "None")
+ set(RunCMake_TEST_FAILED "iface.h referenced as ${rule} instead of None in\n ${vcProjectFile}")
+ return()
+ endif()
+ if(found_iface_h)
+ set(RunCMake_TEST_FAILED "iface.h referenced multiple times in\n ${vcProjectFile}")
+ return()
+ endif()
+ set(found_iface_h 1)
+ endif()
+endforeach()
+if(NOT found_iface_h)
+ set(RunCMake_TEST_FAILED "iface.h not referenced in\n ${vcProjectFile}")
+endif()
diff --git a/Tests/RunCMake/VS10Project/InterfaceLibSources.cmake b/Tests/RunCMake/VS10Project/InterfaceLibSources.cmake
new file mode 100644
index 0000000..3672be1
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/InterfaceLibSources.cmake
@@ -0,0 +1 @@
+add_library(iface INTERFACE iface.h)
diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
index 93ef603..e9f251a 100644
--- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
+++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
@@ -6,6 +6,7 @@ cmake_policy(SET CMP0054 NEW)
run_cmake(VsCsharpSourceGroup)
run_cmake(VsCSharpCompilerOpts)
run_cmake(ExplicitCMakeLists)
+run_cmake(InterfaceLibSources)
run_cmake(RuntimeLibrary)
run_cmake(SourceGroupCMakeLists)
run_cmake(SourceGroupTreeCMakeLists)
diff --git a/Tests/RunCMake/VS10Project/iface.h b/Tests/RunCMake/VS10Project/iface.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/iface.h
diff --git a/Tests/RunCMake/XcodeProject/InterfaceLibSources-check.cmake b/Tests/RunCMake/XcodeProject/InterfaceLibSources-check.cmake
new file mode 100644
index 0000000..613951a
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/InterfaceLibSources-check.cmake
@@ -0,0 +1,16 @@
+set(xcProjectFile "${RunCMake_TEST_BINARY_DIR}/InterfaceLibSources.xcodeproj/project.pbxproj")
+if(NOT EXISTS "${xcProjectFile}")
+ set(RunCMake_TEST_FAILED "Project file ${xcProjectFile} does not exist.")
+ return()
+endif()
+
+set(found_iface_h 0)
+file(STRINGS "${xcProjectFile}" lines)
+foreach(line IN LISTS lines)
+ if(line MATCHES "PBXFileReference.*explicitFileType.*sourcecode\\.c\\.h.*iface\\.h")
+ set(found_iface_h 1)
+ endif()
+endforeach()
+if(NOT found_iface_h)
+ set(RunCMake_TEST_FAILED "iface.h not referenced in\n ${xcProjectFile}")
+endif()
diff --git a/Tests/RunCMake/XcodeProject/InterfaceLibSources.cmake b/Tests/RunCMake/XcodeProject/InterfaceLibSources.cmake
new file mode 100644
index 0000000..3672be1
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/InterfaceLibSources.cmake
@@ -0,0 +1 @@
+add_library(iface INTERFACE iface.h)
diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
index 342dbbc..cd6fd06 100644
--- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
+++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
@@ -2,6 +2,7 @@ include(RunCMake)
run_cmake(ExplicitCMakeLists)
run_cmake(ImplicitCMakeLists)
+run_cmake(InterfaceLibSources)
run_cmake(XcodeFileType)
run_cmake(XcodeAttributeLocation)
diff --git a/Tests/RunCMake/XcodeProject/iface.h b/Tests/RunCMake/XcodeProject/iface.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/iface.h
diff --git a/Tests/RunCMake/ctest_memcheck/DummyCudaMemcheck-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyCudaMemcheck-stderr.txt
index 31dedd2..d302b5c 100644
--- a/Tests/RunCMake/ctest_memcheck/DummyCudaMemcheck-stderr.txt
+++ b/Tests/RunCMake/ctest_memcheck/DummyCudaMemcheck-stderr.txt
@@ -1 +1 @@
-Defect count: 20
+Defect count: 23
diff --git a/Tests/RunCMake/ctest_memcheck/DummyCudaMemcheck-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyCudaMemcheck-stdout.txt
index aa3e698..034ee1e 100644
--- a/Tests/RunCMake/ctest_memcheck/DummyCudaMemcheck-stdout.txt
+++ b/Tests/RunCMake/ctest_memcheck/DummyCudaMemcheck-stdout.txt
@@ -1,9 +1,12 @@
Memory checking results:
Uninitialized __global__ memory read - 1
Unused memory - 1
+Host API memory access error - 1
Barrier error - 2
Invalid __global__ read - 1
cudaErrorLaunchFailure - 2
+Fatal UVM GPU fault - 1
+Fatal UVM CPU fault - 1
Memory leak - 1
Potential WAR hazard detected - 4
Potential RAW hazard detected - 4
diff --git a/Tests/RunCMake/ctest_memcheck/testCudaMemcheck.cmake b/Tests/RunCMake/ctest_memcheck/testCudaMemcheck.cmake
index d7d8213..adc7a1a 100644
--- a/Tests/RunCMake/ctest_memcheck/testCudaMemcheck.cmake
+++ b/Tests/RunCMake/ctest_memcheck/testCudaMemcheck.cmake
@@ -37,6 +37,15 @@ file(APPEND "${LOG_FILE}"
========= Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505]
========= Host Frame:./uninit-read [0x31e2]
=========
+========= Host API memory access error at host access to 0x1303fd1400 of size 25600 bytes
+========= Uninitialized access at 0x1303fd4600 on access by cudaMemcopy source.
+========= Saved host backtrace up to driver entry point at error
+========= Host Frame:/usr/lib/x86_64-linux-gnu/libcuda.so.1 (cuMemcpyDtoH_v2 + 0x1ec) [0x29200c]
+========= Host Frame:/usr/local/cuda/targets/x86_64-linux/lib/libcudart.so.10.1 [0x38aaa]
+========= Host Frame:/usr/local/cuda/targets/x86_64-linux/lib/libcudart.so.10.1 [0x18946]
+========= Host Frame:/usr/local/cuda/targets/x86_64-linux/lib/libcudart.so.10.1 (cudaMemcpy + 0x1a2) [0x3b8c2]
+========= Host Frame:/something/somewhere [0xcafe]
+=========
========= ERROR SUMMARY: 2 errors
")
@@ -108,6 +117,12 @@ file(APPEND "${LOG_FILE}"
========= Host Frame:/lib64/libc.so.6 (__libc_start_main + 0xf5) [0x22505]
========= Host Frame:./invalid-read [0x31e2]
=========
+========= Fatal UVM GPU fault of type invalid pde due to invalid address
+========= during atomic access to address 0x20be00000
+=========
+========= Fatal UVM CPU fault due to invalid operation
+========= during read access to address 0x1357c92000
+=========
========= LEAK SUMMARY: 0 bytes leaked in 0 allocations
========= ERROR SUMMARY: 3 errors
")