diff options
Diffstat (limited to 'Tests')
295 files changed, 1851 insertions, 94 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 0daf4ae..95162ec 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -440,6 +440,10 @@ if(BUILD_TESTING) ADD_TEST_MACRO(CSharpOnly CSharpOnly) ADD_TEST_MACRO(CSharpLinkToCxx CSharpLinkToCxx) ADD_TEST_MACRO(CSharpLinkFromCxx CSharpLinkFromCxx) + ADD_TEST_MACRO(CSharpWin32GenEx CSharpWin32GenEx) + set_tests_properties(CSharpWin32GenEx PROPERTIES + PASS_REGULAR_EXPRESSION "Target \"CSharpWin32GenEx\" has a generator expression in its\n WIN32_EXECUTABLE property\\. This is not supported on managed executables\\." + ) endif() ADD_TEST_MACRO(COnly COnly) @@ -3244,6 +3248,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/CSharpWin32GenEx/CMakeLists.txt b/Tests/CSharpWin32GenEx/CMakeLists.txt new file mode 100644 index 0000000..f4a8d00 --- /dev/null +++ b/Tests/CSharpWin32GenEx/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.18) +project(CSharpWin32GenEx CSharp) + +add_executable(CSharpWin32GenEx csharpwin32genex.cs) +set_property(TARGET CSharpWin32GenEx PROPERTY WIN32_EXECUTABLE $<1:1>) diff --git a/Tests/CSharpWin32GenEx/csharpwin32genex.cs b/Tests/CSharpWin32GenEx/csharpwin32genex.cs new file mode 100644 index 0000000..9892ee0 --- /dev/null +++ b/Tests/CSharpWin32GenEx/csharpwin32genex.cs @@ -0,0 +1,9 @@ +namespace CSharpWin32GenEx +{ + class CSharpWin32GenEx + { + public static void Main(string[] args) + { + } + } +} 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/FindX11/Test/CMakeLists.txt b/Tests/FindX11/Test/CMakeLists.txt index 7325b32..5b304d9 100644 --- a/Tests/FindX11/Test/CMakeLists.txt +++ b/Tests/FindX11/Test/CMakeLists.txt @@ -33,6 +33,8 @@ test_x11_component(x11_components Xaw) test_x11_component(x11_components xcb) test_x11_component(x11_components X11_xcb) test_x11_component(x11_components xcb_icccm) +test_x11_component(x11_components xcb_util) +test_x11_component(x11_components xcb_xfixes) test_x11_component(x11_components xcb_xkb) test_x11_component(x11_components Xcomposite) test_x11_component(x11_components Xdamage) @@ -72,6 +74,8 @@ foreach(lib xcb X11_xcb xcb_icccm + xcb_util + xcb_xfixes Xcomposite Xdamage Xdmcp diff --git a/Tests/FindX11/Test/main.c b/Tests/FindX11/Test/main.c index f8c723c..b44ae28 100644 --- a/Tests/FindX11/Test/main.c +++ b/Tests/FindX11/Test/main.c @@ -326,6 +326,44 @@ static void test_Xaw(void) #endif +#ifdef HAVE_xcb +# include <xcb/xcb.h> + +static void test_xcb(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_disconnect(connection); +} + +# ifdef HAVE_xcb_util +# include <xcb/xcb_aux.h> + +static void test_xcb_util(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_screen_t* screen = xcb_aux_get_screen(connection, screen_nbr); + xcb_disconnect(connection); +} + +# endif + +# ifdef HAVE_xcb_xfixes +# include <xcb/xcb_xfixes.h> + +static void test_xcb_xfixes(void) +{ + int screen_nbr; + xcb_connection_t* connection = xcb_connect(NULL, &screen_nbr); + xcb_xfixes_query_version(connection, 1, 0); + xcb_disconnect(connection); +} + +# endif + +#endif + #include <stddef.h> int main(int argc, char* argv[]) @@ -413,6 +451,16 @@ int main(int argc, char* argv[]) #ifdef HAVE_X11_Xaw test_Xaw, #endif +#ifdef HAVE_xcb + test_xcb, +#endif +#ifdef HAVE_xcb_util + test_xcb_util, +#endif +#ifdef HAVE_xcb_xfixes + test_xcb_xfixes, +#endif + NULL, }; 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/QtAutogen/RerunMocOnAddFile/CMakeLists.txt b/Tests/QtAutogen/RerunMocOnAddFile/CMakeLists.txt new file mode 100644 index 0000000..2677659 --- /dev/null +++ b/Tests/QtAutogen/RerunMocOnAddFile/CMakeLists.txt @@ -0,0 +1,96 @@ +# This test checks whether adding a source file to the project triggers an AUTOMOC re-run. + +cmake_minimum_required(VERSION 3.10) +project(RerunMocOnAddFile) +include("../AutogenCoreTest.cmake") + +# Create an executable to generate a clean target +set(main_source "${CMAKE_CURRENT_BINARY_DIR}/generated_main.cpp") +file(WRITE "${main_source}" "int main() {}") +add_executable(exe "${main_source}") + +# Utility variables +set(timeformat "%Y.%j.%H.%M%S") +set(testProjectTemplateDir "${CMAKE_CURRENT_SOURCE_DIR}/MocOnAddFile") +set(testProjectSrc "${CMAKE_CURRENT_BINARY_DIR}/MocOnAddFile") +set(testProjectBinDir "${CMAKE_CURRENT_BINARY_DIR}/MocOnAddFile-build") + +# Utility macros +macro(sleep) + message(STATUS "Sleeping for a few seconds.") + execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) +endmacro() + +macro(acquire_timestamp When) + file(TIMESTAMP "${mocBasicBin}" time${When} "${timeformat}") +endmacro() + +macro(rebuild buildName) + message(STATUS "Starting build ${buildName}.") + execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${testProjectBinDir}" RESULT_VARIABLE result) + if (result) + message(FATAL_ERROR "Build ${buildName} failed.") + else() + message(STATUS "Build ${buildName} finished.") + endif() +endmacro() + +macro(require_change) + if (timeAfter VERSION_GREATER timeBefore) + message(STATUS "As expected the file ${mocBasicBin} changed.") + else() + message(SEND_ERROR "Unexpectedly the file ${mocBasicBin} did not change!\nTimestamp pre: ${timeBefore}\nTimestamp aft: ${timeAfter}\n") + endif() +endmacro() + +macro(require_change_not) + if (timeAfter VERSION_GREATER timeBefore) + message(SEND_ERROR "Unexpectedly the file ${mocBasicBin} changed!\nTimestamp pre: ${timeBefore}\nTimestamp aft: ${timeAfter}\n") + else() + message(STATUS "As expected the file ${mocBasicBin} did not change.") + endif() +endmacro() + +# Create the test project from the template +unset(additional_project_sources) +unset(main_cpp_includes) +configure_file("${testProjectTemplateDir}/CMakeLists.txt.in" "${testProjectSrc}/CMakeLists.txt") +configure_file("${testProjectTemplateDir}/main.cpp.in" "${testProjectSrc}/main.cpp") + +# Initial build +try_compile(MOC_RERUN + "${testProjectBinDir}" + "${testProjectSrc}" + MocOnAddFile + CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}" + "-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}" + "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" + OUTPUT_VARIABLE output +) +if (NOT MOC_RERUN) + message(FATAL_ERROR "Initial build of mocOnAddFile failed. Output: ${output}") +endif() + +# Sleep to ensure new timestamps +sleep() + +# Add a QObject class (defined in header) to the project and build +set(additional_project_sources myobject.cpp) +set(main_cpp_includes "#include \"myobject.h\"") +configure_file("${testProjectTemplateDir}/CMakeLists.txt.in" "${testProjectSrc}/CMakeLists.txt" + @ONLY) +configure_file("${testProjectTemplateDir}/main.cpp.in" "${testProjectSrc}/main.cpp" @ONLY) +configure_file("${testProjectTemplateDir}/myobject.h" "${testProjectSrc}/myobject.h" COPYONLY) +configure_file("${testProjectTemplateDir}/myobject.cpp" "${testProjectSrc}/myobject.cpp" COPYONLY) +rebuild(2) + +# Sleep to ensure new timestamps +sleep() + +# Add a QObject class (defined in source) to the project and build +set(additional_project_sources myobject.cpp anotherobject.cpp) +configure_file("${testProjectTemplateDir}/CMakeLists.txt.in" "${testProjectSrc}/CMakeLists.txt" + @ONLY) +configure_file("${testProjectTemplateDir}/anotherobject.cpp" "${testProjectSrc}/anotherobject.cpp" + COPYONLY) +rebuild(3) diff --git a/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/CMakeLists.txt.in b/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/CMakeLists.txt.in new file mode 100644 index 0000000..9e5e21c --- /dev/null +++ b/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/CMakeLists.txt.in @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.10) +project(MocOnAddFile) +include("@CMAKE_CURRENT_LIST_DIR@/../AutogenCoreTest.cmake") + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) + +add_executable(mocOnAddFile main.cpp @additional_project_sources@) +target_link_libraries(mocOnAddFile ${QT_QTCORE_TARGET}) diff --git a/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/anotherobject.cpp b/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/anotherobject.cpp new file mode 100644 index 0000000..45c5af6 --- /dev/null +++ b/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/anotherobject.cpp @@ -0,0 +1,15 @@ +#include <qobject.h> + +class AnotherObject : public QObject +{ + Q_OBJECT +public: + AnotherObject() {} +}; + +AnotherObject* createAnotherObject() +{ + return new AnotherObject(); +} + +#include "anotherobject.moc" diff --git a/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/main.cpp.in b/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/main.cpp.in new file mode 100644 index 0000000..f62027a --- /dev/null +++ b/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/main.cpp.in @@ -0,0 +1,6 @@ +@main_cpp_includes@ + +int main(int argc, char *argv[]) +{ + return 0; +} diff --git a/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/myobject.cpp b/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/myobject.cpp new file mode 100644 index 0000000..7a15300 --- /dev/null +++ b/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/myobject.cpp @@ -0,0 +1,6 @@ +#include "myobject.h" + +MyObject::MyObject(QObject* parent) + : QObject(parent) +{ +} diff --git a/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/myobject.h b/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/myobject.h new file mode 100644 index 0000000..e373ee8 --- /dev/null +++ b/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/myobject.h @@ -0,0 +1,13 @@ +#ifndef MYOBJECT_H +#define MYOBJECT_H + +#include <qobject.h> + +class MyObject : public QObject +{ + Q_OBJECT +public: + MyObject(QObject* parent = 0); +}; + +#endif diff --git a/Tests/QtAutogen/Tests.cmake b/Tests/QtAutogen/Tests.cmake index dfa5ea0..0c7bd79 100644 --- a/Tests/QtAutogen/Tests.cmake +++ b/Tests/QtAutogen/Tests.cmake @@ -20,6 +20,7 @@ ADD_AUTOGEN_TEST(RccOffMocLibrary) ADD_AUTOGEN_TEST(RccOnly rccOnly) ADD_AUTOGEN_TEST(RccSkipSource) ADD_AUTOGEN_TEST(RerunMocBasic) +ADD_AUTOGEN_TEST(RerunMocOnAddFile) ADD_AUTOGEN_TEST(RerunRccConfigChange) ADD_AUTOGEN_TEST(RerunRccDepends) ADD_AUTOGEN_TEST(SameName sameName) diff --git a/Tests/RunCMake/CMP0026/CMP0026-IMPORTED.cmake b/Tests/RunCMake/CMP0026/CMP0026-IMPORTED.cmake index 650c8a5..ae62e79 100644 --- a/Tests/RunCMake/CMP0026/CMP0026-IMPORTED.cmake +++ b/Tests/RunCMake/CMP0026/CMP0026-IMPORTED.cmake @@ -1,6 +1,7 @@ enable_language(CXX) +cmake_policy(SET CMP0111 OLD) add_library(someimportedlib SHARED IMPORTED) get_target_property(_loc someimportedlib LOCATION) diff --git a/Tests/RunCMake/CMP0111/CMP0111-Common.cmake b/Tests/RunCMake/CMP0111/CMP0111-Common.cmake new file mode 100644 index 0000000..564169d --- /dev/null +++ b/Tests/RunCMake/CMP0111/CMP0111-Common.cmake @@ -0,0 +1,9 @@ +# Prevent duplicate errors on some platforms. +set(CMAKE_IMPORT_LIBRARY_SUFFIX "placeholder") + +add_library(unknown_lib UNKNOWN IMPORTED) +add_library(static_lib STATIC IMPORTED) +add_library(shared_lib SHARED IMPORTED) + +add_executable(executable main.cpp) +target_link_libraries(executable unknown_lib static_lib shared_lib) diff --git a/Tests/RunCMake/InterfaceLibrary/whitelist-result.txt b/Tests/RunCMake/CMP0111/CMP0111-NEW-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/InterfaceLibrary/whitelist-result.txt +++ b/Tests/RunCMake/CMP0111/CMP0111-NEW-result.txt diff --git a/Tests/RunCMake/CMP0111/CMP0111-NEW-stderr.txt b/Tests/RunCMake/CMP0111/CMP0111-NEW-stderr.txt new file mode 100644 index 0000000..ba5d936 --- /dev/null +++ b/Tests/RunCMake/CMP0111/CMP0111-NEW-stderr.txt @@ -0,0 +1,7 @@ +CMake Error in CMakeLists.txt: + IMPORTED_LOCATION not set for imported target "static_lib"( configuration + ".+")?. ++ +CMake Error in CMakeLists.txt: + IMPORTED_IMPLIB not set for imported target "shared_lib"( configuration + ".+")?. diff --git a/Tests/RunCMake/CMP0111/CMP0111-NEW.cmake b/Tests/RunCMake/CMP0111/CMP0111-NEW.cmake new file mode 100644 index 0000000..d0c8dd3 --- /dev/null +++ b/Tests/RunCMake/CMP0111/CMP0111-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0111 NEW) +include(CMP0111-Common.cmake) diff --git a/Tests/RunCMake/CMP0111/CMP0111-OLD.cmake b/Tests/RunCMake/CMP0111/CMP0111-OLD.cmake new file mode 100644 index 0000000..d00847a --- /dev/null +++ b/Tests/RunCMake/CMP0111/CMP0111-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0111 OLD) +include(CMP0111-Common.cmake) diff --git a/Tests/RunCMake/CMP0111/CMP0111-WARN-stderr.txt b/Tests/RunCMake/CMP0111/CMP0111-WARN-stderr.txt new file mode 100644 index 0000000..2fe6cc8 --- /dev/null +++ b/Tests/RunCMake/CMP0111/CMP0111-WARN-stderr.txt @@ -0,0 +1,26 @@ +CMake Warning \(dev\) in CMakeLists.txt: + Policy CMP0111 is not set: An imported target with a missing location fails + during generation. Run "cmake --help-policy CMP0111" for policy details. + Use the cmake_policy command to set the policy and suppress this warning. + + IMPORTED_LOCATION not set for imported target "unknown_lib"( configuration + ".+")?. +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) in CMakeLists.txt: + Policy CMP0111 is not set: An imported target with a missing location fails + during generation. Run "cmake --help-policy CMP0111" for policy details. + Use the cmake_policy command to set the policy and suppress this warning. + + IMPORTED_LOCATION not set for imported target "static_lib"( configuration + ".+")?. +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) in CMakeLists.txt: + Policy CMP0111 is not set: An imported target with a missing location fails + during generation. Run "cmake --help-policy CMP0111" for policy details. + Use the cmake_policy command to set the policy and suppress this warning. + + IMPORTED_IMPLIB not set for imported target "shared_lib"( configuration + ".+")?. +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0111/CMP0111-WARN.cmake b/Tests/RunCMake/CMP0111/CMP0111-WARN.cmake new file mode 100644 index 0000000..0efe48c --- /dev/null +++ b/Tests/RunCMake/CMP0111/CMP0111-WARN.cmake @@ -0,0 +1 @@ +include(CMP0111-Common.cmake) diff --git a/Tests/RunCMake/CMP0111/CMakeLists.txt b/Tests/RunCMake/CMP0111/CMakeLists.txt new file mode 100644 index 0000000..9f19a75 --- /dev/null +++ b/Tests/RunCMake/CMP0111/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.17) +project(${RunCMake_TEST} CXX) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0111/RunCMakeTest.cmake b/Tests/RunCMake/CMP0111/RunCMakeTest.cmake new file mode 100644 index 0000000..02e420a --- /dev/null +++ b/Tests/RunCMake/CMP0111/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +run_cmake(CMP0111-OLD) +run_cmake(CMP0111-NEW) +run_cmake(CMP0111-WARN) diff --git a/Tests/RunCMake/CMP0111/main.cpp b/Tests/RunCMake/CMP0111/main.cpp new file mode 100644 index 0000000..5047a34 --- /dev/null +++ b/Tests/RunCMake/CMP0111/main.cpp @@ -0,0 +1,3 @@ +int main() +{ +} diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index e08b30a..65e8b0b 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -124,6 +124,7 @@ if(CMake_TEST_CUDA) PROPERTY LABELS "CUDA") endif() add_RunCMake_test(CMP0106) +add_RunCMake_test(CMP0111) # The test for Policy 65 requires the use of the # CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS variable, which both the VS and Xcode @@ -292,6 +293,7 @@ add_RunCMake_test(add_dependencies) add_RunCMake_test(add_executable) add_RunCMake_test(add_library) add_RunCMake_test(add_subdirectory) +add_RunCMake_test(add_test) add_RunCMake_test(build_command) add_executable(exit_code exit_code.c) set(execute_process_ARGS -DEXIT_CODE_EXE=$<TARGET_FILE:exit_code>) @@ -365,6 +367,15 @@ function(add_RunCMake_test_try_compile) unset(CMAKE_CXX_STANDARD_DEFAULT) endif() endif() + if(CMAKE_VERSION VERSION_LESS 3.18.20200813 AND "x${CMAKE_C_COMPILER_ID}" STREQUAL "xMSVC") + # Older CMake versions do not know about MSVC language standards. + # Approximate our logic from MSVC-C.cmake. + if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 19.27) + set(CMAKE_C_STANDARD_DEFAULT 99) + else() + set(CMAKE_C_STANDARD_DEFAULT "") + endif() + endif() foreach(var CMAKE_SYSTEM_NAME CMAKE_C_COMPILER_ID @@ -401,6 +412,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.) @@ -721,3 +733,7 @@ add_RunCMake_test("CTestCommandExpandLists") add_RunCMake_test(PrecompileHeaders -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}) add_RunCMake_test("UnityBuild") + +if(WIN32) + add_RunCMake_test(Win32GenEx) +endif() diff --git a/Tests/RunCMake/CTest/RunCMakeTest.cmake b/Tests/RunCMake/CTest/RunCMakeTest.cmake index 761224a..62606f8 100644 --- a/Tests/RunCMake/CTest/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTest/RunCMakeTest.cmake @@ -18,3 +18,12 @@ function(run_CMakeCTestArguments) run_cmake_command(CMakeCTestArguments-test ${CMAKE_COMMAND} --build . --config Debug --target "${test}") endfunction() run_CMakeCTestArguments() + +function(run_TestfileErrors) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TestfileErrors-build) + run_cmake(TestfileErrors) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(TestfileErrors-build ${CMAKE_COMMAND} --build . --config Debug) + run_cmake_command(TestfileErrors-test ${CMAKE_CTEST_COMMAND} -C Debug) +endfunction() +run_TestfileErrors() diff --git a/Tests/RunCMake/CTest/TestfileErrors-Script.cmake b/Tests/RunCMake/CTest/TestfileErrors-Script.cmake new file mode 100644 index 0000000..d9fc7c8 --- /dev/null +++ b/Tests/RunCMake/CTest/TestfileErrors-Script.cmake @@ -0,0 +1,4 @@ +message(SEND_ERROR "SEND_ERROR") +message(FATAL_ERROR "FATAL_ERROR") +# This shouldn't get printed because the script aborts on FATAL_ERROR +message(SEND_ERROR "reaching the unreachable") diff --git a/Tests/RunCMake/CTest/TestfileErrors-test-result.txt b/Tests/RunCMake/CTest/TestfileErrors-test-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/CTest/TestfileErrors-test-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/CTest/TestfileErrors-test-stderr.txt b/Tests/RunCMake/CTest/TestfileErrors-test-stderr.txt new file mode 100644 index 0000000..a3a476b --- /dev/null +++ b/Tests/RunCMake/CTest/TestfileErrors-test-stderr.txt @@ -0,0 +1,11 @@ +CMake Error at [^ +]*/Tests/RunCMake/CTest/TestfileErrors-Script.cmake:1 \(message\): + SEND_ERROR +Call Stack \(most recent call first\): + CTestTestfile.cmake:[0-9]+ \(include\) ++ +CMake Error at [^ +]*/Tests/RunCMake/CTest/TestfileErrors-Script.cmake:2 \(message\): + FATAL_ERROR +Call Stack \(most recent call first\): + CTestTestfile.cmake:[0-9]+ \(include\) diff --git a/Tests/RunCMake/CTest/TestfileErrors.cmake b/Tests/RunCMake/CTest/TestfileErrors.cmake new file mode 100644 index 0000000..676eb47 --- /dev/null +++ b/Tests/RunCMake/CTest/TestfileErrors.cmake @@ -0,0 +1,3 @@ +include(CTest) +add_test(NAME "unreachable" COMMAND ${CMAKE_COMMAND} -E true) +set_property(DIRECTORY PROPERTY TEST_INCLUDE_FILE ${CMAKE_CURRENT_SOURCE_DIR}/TestfileErrors-Script.cmake) diff --git a/Tests/RunCMake/CTestCommandLine/BadCTestTestfile-result.txt b/Tests/RunCMake/CTestCommandLine/BadCTestTestfile-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/BadCTestTestfile-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/CTestCommandLine/BadCTestTestfile-stderr.txt b/Tests/RunCMake/CTestCommandLine/BadCTestTestfile-stderr.txt index d95bb33..97e2a10 100644 --- a/Tests/RunCMake/CTestCommandLine/BadCTestTestfile-stderr.txt +++ b/Tests/RunCMake/CTestCommandLine/BadCTestTestfile-stderr.txt @@ -1,4 +1,4 @@ ^CMake Error at CTestTestfile.cmake:[0-9]+ \(subdirs\): subdirs called with incorrect number of arguments + -No tests were found!!!$ +Errors while running CTest$ diff --git a/Tests/RunCMake/CTestCommandLine/TestOutputSize-stderr.txt b/Tests/RunCMake/CTestCommandLine/TestOutputSize-stderr.txt index ba4235d..19310b8 100644 --- a/Tests/RunCMake/CTestCommandLine/TestOutputSize-stderr.txt +++ b/Tests/RunCMake/CTestCommandLine/TestOutputSize-stderr.txt @@ -1 +1,2 @@ +^Cannot find file: .*/Tests/RunCMake/CTestCommandLine/TestOutputSize/DartConfiguration.tcl Errors while running CTest 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/ExternalProject/DownloadInactivityResume.cmake b/Tests/RunCMake/ExternalProject/DownloadInactivityResume.cmake new file mode 100644 index 0000000..d34482d --- /dev/null +++ b/Tests/RunCMake/ExternalProject/DownloadInactivityResume.cmake @@ -0,0 +1,5 @@ +include(ExternalProject) +ExternalProject_Add(MyProj URL ${SERVER_URL} INACTIVITY_TIMEOUT 2 DOWNLOAD_NO_EXTRACT TRUE + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "") diff --git a/Tests/RunCMake/ExternalProject/DownloadInactivityTimeout-build-result.txt b/Tests/RunCMake/ExternalProject/DownloadInactivityTimeout-build-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/DownloadInactivityTimeout-build-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/ExternalProject/DownloadInactivityTimeout-build-stdout.txt b/Tests/RunCMake/ExternalProject/DownloadInactivityTimeout-build-stdout.txt new file mode 100644 index 0000000..3238147 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/DownloadInactivityTimeout-build-stdout.txt @@ -0,0 +1 @@ +(Timeout was reached)? diff --git a/Tests/RunCMake/ExternalProject/DownloadInactivityTimeout.cmake b/Tests/RunCMake/ExternalProject/DownloadInactivityTimeout.cmake new file mode 100644 index 0000000..d34482d --- /dev/null +++ b/Tests/RunCMake/ExternalProject/DownloadInactivityTimeout.cmake @@ -0,0 +1,5 @@ +include(ExternalProject) +ExternalProject_Add(MyProj URL ${SERVER_URL} INACTIVITY_TIMEOUT 2 DOWNLOAD_NO_EXTRACT TRUE + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "") diff --git a/Tests/RunCMake/ExternalProject/DownloadServer.py b/Tests/RunCMake/ExternalProject/DownloadServer.py new file mode 100644 index 0000000..3738317 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/DownloadServer.py @@ -0,0 +1,49 @@ +from http.server import HTTPServer, BaseHTTPRequestHandler +import argparse +import time +import subprocess +import sys +import os +import threading +args = None +outerthread = None + +class SimpleHTTPRequestHandler(BaseHTTPRequestHandler): + def do_GET(self): + self.send_response(200) + self.end_headers() + data = b'D' + + if args.speed_limit: + slow_deadline = time.time()+args.limit_duration + + while time.time() < slow_deadline: + self.wfile.write(data) + if args.speed_limit: + time.sleep(1.1) + + data = data * 100 + self.wfile.write(data) + self.close_connection = True + +def runServer(fileName): + httpd = HTTPServer(('localhost', 0), SimpleHTTPRequestHandler) + with open(fileName,"w") as f: + f.write('http://localhost:{}/test'.format(httpd.socket.getsockname()[1])) + httpd.handle_request() + os.remove(fileName) + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument('--speed_limit', help='transfer rate limitation', action='store_true',default=False) + parser.add_argument('--limit_duration', help='duration of the transfer rate limitation',default=1, type=float) + parser.add_argument('--file', help='file to write the url to connect to') + parser.add_argument('--subprocess', action='store_true') + args = parser.parse_args() + if not args.subprocess: + subprocess.Popen([sys.executable]+sys.argv+['--subprocess'],stdin=subprocess.DEVNULL, stderr=subprocess.DEVNULL,stdout=subprocess.DEVNULL) + else: + serverThread = threading.Thread(target=runServer,args=(args.file,)) + serverThread.daemon = True + serverThread.start() + serverThread.join(15) diff --git a/Tests/RunCMake/ExternalProject/DownloadTimeout-build-result.txt b/Tests/RunCMake/ExternalProject/DownloadTimeout-build-result.txt new file mode 100644 index 0000000..c20fd86 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/DownloadTimeout-build-result.txt @@ -0,0 +1 @@ +^[^0] diff --git a/Tests/RunCMake/ExternalProject/DownloadTimeout-build-stderr.txt b/Tests/RunCMake/ExternalProject/DownloadTimeout-build-stderr.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/ExternalProject/DownloadTimeout-build-stderr.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/ExternalProject/DownloadTimeout.cmake b/Tests/RunCMake/ExternalProject/DownloadTimeout.cmake new file mode 100644 index 0000000..c90b4ba --- /dev/null +++ b/Tests/RunCMake/ExternalProject/DownloadTimeout.cmake @@ -0,0 +1,5 @@ +include(ExternalProject) +set(source_dir "${CMAKE_CURRENT_BINARY_DIR}/DownloadTimeout") +file(REMOVE_RECURSE "${source_dir}") +file(MAKE_DIRECTORY "${source_dir}") +ExternalProject_Add(MyProj URL "http://cmake.org/invalid_file.tar.gz") diff --git a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake index 0d1da26..c2c77e0 100644 --- a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake @@ -1,5 +1,11 @@ +cmake_minimum_required(VERSION 3.12) include(RunCMake) +# We do not contact any remote URLs, but may use a local one. +# Remove any proxy configuration that may change behavior. +unset(ENV{http_proxy}) +unset(ENV{https_proxy}) + run_cmake(IncludeScope-Add) run_cmake(IncludeScope-Add_Step) run_cmake(NoOptions) @@ -27,6 +33,50 @@ function(__ep_test_with_build testName) run_cmake_command(${testName}-build ${CMAKE_COMMAND} --build .) endfunction() +find_package(Python3) +function(__ep_test_with_build_with_server testName) + if(NOT Python3_EXECUTABLE) + return() + endif() + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${testName}-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_TIMEOUT 20) + set(RunCMake_TEST_OUTPUT_MERGE TRUE) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + set(URL_FILE ${RunCMake_BINARY_DIR}/${testName}.url) + if(EXISTS "${URL_FILE}") + file(REMOVE "${URL_FILE}") + endif() + execute_process( + COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_LIST_DIR}/DownloadServer.py --file "${URL_FILE}" ${ARGN} + OUTPUT_FILE ${RunCMake_BINARY_DIR}/${testName}-python.txt + ERROR_FILE ${RunCMake_BINARY_DIR}/${testName}-python.txt + RESULT_VARIABLE result + TIMEOUT 30 + ) + if(NOT result EQUAL 0) + message(FATAL_ERROR "Failed to start download server:\n ${result}") + endif() + + foreach(i RANGE 1 8) + if(EXISTS ${URL_FILE}) + break() + endif() + execute_process(COMMAND ${CMAKE_COMMAND} -E sleep ${i}) + endforeach() + + if(NOT EXISTS ${URL_FILE}) + message(FATAL_ERROR "Failed to load download server URL from:\n ${URL_FILE}") + endif() + + file(READ ${URL_FILE} SERVER_URL) + message(STATUS "URL : ${URL_FILE} - ${SERVER_URL}") + run_cmake_with_options(${testName} ${CMAKE_COMMAND} -DSERVER_URL=${SERVER_URL} ) + run_cmake_command(${testName}-clean ${CMAKE_COMMAND} --build . --target clean) + run_cmake_command(${testName}-build ${CMAKE_COMMAND} --build .) +endfunction() + __ep_test_with_build(MultiCommand) set(RunCMake_TEST_OUTPUT_MERGE 1) @@ -38,6 +88,9 @@ set(RunCMake_TEST_OUTPUT_MERGE 0) if(NOT RunCMake_GENERATOR MATCHES "Visual Studio") __ep_test_with_build(LogOutputOnFailure) __ep_test_with_build(LogOutputOnFailureMerged) + __ep_test_with_build(DownloadTimeout) + __ep_test_with_build_with_server(DownloadInactivityTimeout --speed_limit --limit_duration 40) + __ep_test_with_build_with_server(DownloadInactivityResume --speed_limit --limit_duration 1) endif() # We can't test the substitution when using the old MSYS due to diff --git a/Tests/RunCMake/FetchContent/DirOverrides.cmake b/Tests/RunCMake/FetchContent/DirOverrides.cmake index 50eef16..ad61a00 100644 --- a/Tests/RunCMake/FetchContent/DirOverrides.cmake +++ b/Tests/RunCMake/FetchContent/DirOverrides.cmake @@ -4,18 +4,23 @@ include(FetchContent) FetchContent_Declare( t1 SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/savedSrc - DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E make_directory <SOURCE_DIR> + BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/savedBin + DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E make_directory <SOURCE_DIR> <BINARY_DIR> ) FetchContent_Populate(t1) if(NOT IS_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/savedSrc) message(FATAL_ERROR "Saved details SOURCE_DIR override failed") endif() +if(NOT IS_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/savedBin) + message(FATAL_ERROR "Saved details BINARY_DIR override failed") +endif() # Test direct population FetchContent_Populate( t2 SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/directSrc - DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E make_directory <SOURCE_DIR> + BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/directBin + DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E make_directory <SOURCE_DIR> <BINARY_DIR> ) if(NOT IS_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/directSrc) message(FATAL_ERROR "Direct details SOURCE_DIR override failed") @@ -44,3 +49,19 @@ FetchContent_Populate( if(IS_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/savedNobuildDir-build) message(FATAL_ERROR "Direct details BINARY_DIR override failed") endif() + +# Test overriding the source directory by reusing the one from t1 +set(FETCHCONTENT_SOURCE_DIR_T5 ${CMAKE_CURRENT_BINARY_DIR}/savedSrc) +FetchContent_Declare( + t5 + SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/doesNotExist + BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/wontBeCreated + DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E false +) +FetchContent_Populate(t5) +if(NOT "${t5_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/savedSrc") + message(FATAL_ERROR "Wrong SOURCE_DIR returned: ${t5_SOURCE_DIR}") +endif() +if(NOT "${t5_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/wontBeCreated") + message(FATAL_ERROR "Wrong BINARY_DIR returned: ${t5_BINARY_DIR}") +endif() diff --git a/Tests/RunCMake/FetchContent/DirOverridesDisconnected.cmake b/Tests/RunCMake/FetchContent/DirOverridesDisconnected.cmake new file mode 100644 index 0000000..768a82e --- /dev/null +++ b/Tests/RunCMake/FetchContent/DirOverridesDisconnected.cmake @@ -0,0 +1,18 @@ +include(FetchContent) + +# Test using saved details. We are re-using a SOURCE_DIR from a previous test +# so the download command should not be executed. +FetchContent_Declare( + t1 + SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/savedSrc + BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/savedBin + DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E false +) +FetchContent_Populate(t1) + +if(NOT "${t1_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/savedSrc") + message(FATAL_ERROR "Wrong SOURCE_DIR returned: ${t1_SOURCE_DIR}") +endif() +if(NOT "${t1_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/savedBin") + message(FATAL_ERROR "Wrong BINARY_DIR returned: ${t1_BINARY_DIR}") +endif() diff --git a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake index f3ed3e2..ad9e48e 100644 --- a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake +++ b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake @@ -10,12 +10,25 @@ run_cmake(DownloadFile) run_cmake(SameGenerator) run_cmake(VarDefinitions) run_cmake(GetProperties) -run_cmake(DirOverrides) run_cmake(UsesTerminalOverride) run_cmake(MakeAvailable) run_cmake(MakeAvailableTwice) run_cmake(MakeAvailableUndeclared) +function(run_FetchContent_DirOverrides) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/DirOverrides-build) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake(DirOverrides) + + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_with_options(DirOverridesDisconnected + -D FETCHCONTENT_FULLY_DISCONNECTED=YES + ) +endfunction() +run_FetchContent_DirOverrides() + set(RunCMake_TEST_OUTPUT_MERGE 1) run_cmake(PreserveEmptyArgs) set(RunCMake_TEST_OUTPUT_MERGE 0) 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/link_imported_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_exe.json index 312f4c5..451e8d4 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_exe.json @@ -14,7 +14,7 @@ "backtrace": [ { "file": "^imported/CMakeLists\\.txt$", - "line": 5, + "line": 6, "command": "add_executable", "hasParent": true }, @@ -49,7 +49,7 @@ "backtrace": [ { "file": "^imported/CMakeLists\\.txt$", - "line": 5, + "line": 6, "command": "add_executable", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_interface_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_interface_exe.json index 7d0e6df..cbd4346 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_interface_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_interface_exe.json @@ -14,7 +14,7 @@ "backtrace": [ { "file": "^imported/CMakeLists\\.txt$", - "line": 23, + "line": 29, "command": "add_executable", "hasParent": true }, @@ -49,7 +49,7 @@ "backtrace": [ { "file": "^imported/CMakeLists\\.txt$", - "line": 23, + "line": 29, "command": "add_executable", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_object_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_object_exe.json index 4aec524..d92a810 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_object_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_object_exe.json @@ -14,7 +14,7 @@ "backtrace": [ { "file": "^imported/CMakeLists\\.txt$", - "line": 18, + "line": 24, "command": "add_executable", "hasParent": true }, @@ -49,7 +49,7 @@ "backtrace": [ { "file": "^imported/CMakeLists\\.txt$", - "line": 18, + "line": 24, "command": "add_executable", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_shared_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_shared_exe.json index f5846ec..1197a73 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_shared_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_shared_exe.json @@ -14,7 +14,7 @@ "backtrace": [ { "file": "^imported/CMakeLists\\.txt$", - "line": 9, + "line": 14, "command": "add_executable", "hasParent": true }, @@ -49,7 +49,7 @@ "backtrace": [ { "file": "^imported/CMakeLists\\.txt$", - "line": 9, + "line": 14, "command": "add_executable", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_static_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_static_exe.json index 29a1695..42564e0 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_static_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_static_exe.json @@ -14,7 +14,7 @@ "backtrace": [ { "file": "^imported/CMakeLists\\.txt$", - "line": 13, + "line": 19, "command": "add_executable", "hasParent": true }, @@ -49,7 +49,7 @@ "backtrace": [ { "file": "^imported/CMakeLists\\.txt$", - "line": 13, + "line": 19, "command": "add_executable", "hasParent": true }, 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/imported/CMakeLists.txt b/Tests/RunCMake/FileAPI/imported/CMakeLists.txt index d36d88b..f79d87c 100644 --- a/Tests/RunCMake/FileAPI/imported/CMakeLists.txt +++ b/Tests/RunCMake/FileAPI/imported/CMakeLists.txt @@ -1,15 +1,21 @@ project(Imported) add_library(imported_lib UNKNOWN IMPORTED) +set_target_properties(imported_lib PROPERTIES IMPORTED_LOCATION "imported_unk${CMAKE_STATIC_LIBRARY_SUFFIX}") add_executable(imported_exe IMPORTED) add_executable(link_imported_exe ../empty.c) target_link_libraries(link_imported_exe PRIVATE imported_lib) add_library(imported_shared_lib SHARED IMPORTED) +set_target_properties(imported_shared_lib PROPERTIES + IMPORTED_LOCATION "imported_shared${CMAKE_SHARED_LIBRARY_SUFFIX}" + IMPORTED_IMPLIB "imported_shared${CMAKE_IMPORT_LIBRARY_SUFFIX}" +) add_executable(link_imported_shared_exe ../empty.c) target_link_libraries(link_imported_shared_exe PRIVATE imported_shared_lib) add_library(imported_static_lib STATIC IMPORTED) +set_target_properties(imported_static_lib PROPERTIES IMPORTED_LOCATION "imported_static${CMAKE_STATIC_LIBRARY_SUFFIX}") add_executable(link_imported_static_exe ../empty.c) target_link_libraries(link_imported_static_exe PRIVATE imported_static_lib) 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/File_Generate/CMP0070-WARN-stderr.txt b/Tests/RunCMake/File_Generate/CMP0070-WARN-stderr.txt index dbabaa9..a7a231b 100644 --- a/Tests/RunCMake/File_Generate/CMP0070-WARN-stderr.txt +++ b/Tests/RunCMake/File_Generate/CMP0070-WARN-stderr.txt @@ -1,4 +1,18 @@ -^CMake Warning \(dev\) in CMakeLists.txt: +^(CMake Warning \(dev\) in CMakeLists.txt: + Policy CMP0070 is not set: Define file\(GENERATE\) behavior for relative + paths. Run "cmake --help-policy CMP0070" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + file\(GENERATE\) given relative OUTPUT path: + + relative-output-WARN.txt + + This is not defined behavior unless CMP0070 is set to NEW. For + compatibility with older versions of CMake, the previous undefined behavior + will be used. +This warning is for project developers. Use -Wno-dev to suppress it. ++)+ +CMake Warning \(dev\) in CMakeLists.txt: Policy CMP0070 is not set: Define file\(GENERATE\) behavior for relative paths. Run "cmake --help-policy CMP0070" for policy details. Use the cmake_policy command to set the policy and suppress this warning. diff --git a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake index 5987417..48fb71c 100644 --- a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake +++ b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake @@ -4,6 +4,10 @@ run_cmake(CMP0070-NEW) run_cmake(CMP0070-OLD) run_cmake(CMP0070-WARN) +run_cmake(SourceProperty) +run_cmake(SourceProperty-CMP0070-NEW) +run_cmake(SourceProperty-CMP0070-OLD) + run_cmake(CommandConflict) if(RunCMake_GENERATOR_IS_MULTI_CONFIG) run_cmake(OutputConflict) @@ -29,6 +33,13 @@ foreach(l CXX C) endif() endforeach() +run_cmake(Target) +file(READ "${RunCMake_BINARY_DIR}/Target-build/sub1/output.txt" sub_1) +file(READ "${RunCMake_BINARY_DIR}/Target-build/sub2/output.txt" sub_2) +if(NOT sub_1 MATCHES "first" OR NOT sub_2 MATCHES "second") + message(SEND_ERROR "Wrong target used by TARGET argument! ${sub_1} ${sub_2}") +endif() + set(timeformat "%Y%j%H%M%S") file(REMOVE "${RunCMake_BINARY_DIR}/WriteIfDifferent-build/output_file.txt") diff --git a/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-NEW-result.txt b/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-NEW-stderr.txt b/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-NEW-stderr.txt new file mode 100644 index 0000000..2c385c4 --- /dev/null +++ b/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-NEW-stderr.txt @@ -0,0 +1,11 @@ +^CMake Error at SourceProperty-CMP0070-NEW.cmake:[0-9]+ \(add_library\): + Cannot find source file: + +.*\/relative-output-NEW\.c + + Tried extensions \.c \.C.* +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) + + +CMake Generate step failed. Build files cannot be regenerated correctly.$ diff --git a/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-NEW.cmake b/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-NEW.cmake new file mode 100644 index 0000000..d2b3e0c --- /dev/null +++ b/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-NEW.cmake @@ -0,0 +1,8 @@ +enable_language(C) +add_library(foo) + +cmake_policy(SET CMP0070 NEW) +file(GENERATE OUTPUT relative-output-NEW.c CONTENT "") +target_sources(foo PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/relative-output-NEW.c" +) diff --git a/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-OLD-result.txt b/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-OLD-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-OLD-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-OLD-stderr.txt b/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-OLD-stderr.txt new file mode 100644 index 0000000..fcb53a7 --- /dev/null +++ b/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-OLD-stderr.txt @@ -0,0 +1,23 @@ +^CMake Deprecation Warning at SourceProperty-CMP0070-OLD.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0070 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) + + +CMake Error at SourceProperty-CMP0070-OLD.cmake:[0-9]+ \(add_library\): + Cannot find source file: + +.*\/relative-output-OLD\.c + + Tried extensions \.c \.C.* +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) + + +CMake Generate step failed. Build files cannot be regenerated correctly.$ diff --git a/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-OLD.cmake b/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-OLD.cmake new file mode 100644 index 0000000..48eae1e --- /dev/null +++ b/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-OLD.cmake @@ -0,0 +1,8 @@ +enable_language(C) +add_library(foo) + +cmake_policy(SET CMP0070 OLD) +file(GENERATE OUTPUT relative-output-OLD.c CONTENT "") +target_sources(foo PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/relative-output-OLD.c" +) diff --git a/Tests/RunCMake/File_Generate/SourceProperty-stderr.txt b/Tests/RunCMake/File_Generate/SourceProperty-stderr.txt new file mode 100644 index 0000000..47ec651 --- /dev/null +++ b/Tests/RunCMake/File_Generate/SourceProperty-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at SourceProperty.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0070 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/File_Generate/SourceProperty.cmake b/Tests/RunCMake/File_Generate/SourceProperty.cmake new file mode 100644 index 0000000..231c670 --- /dev/null +++ b/Tests/RunCMake/File_Generate/SourceProperty.cmake @@ -0,0 +1,14 @@ +enable_language(C) +add_library(SourceProperty) + +cmake_policy(SET CMP0070 OLD) +file(GENERATE OUTPUT relative-output-OLD.c CONTENT "") +target_sources(SourceProperty PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}/relative-output-OLD.c" +) + +cmake_policy(SET CMP0070 NEW) +file(GENERATE OUTPUT relative-output-NEW.c CONTENT "") +target_sources(SourceProperty PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}/relative-output-NEW.c" +) diff --git a/Tests/RunCMake/File_Generate/Target.cmake b/Tests/RunCMake/File_Generate/Target.cmake new file mode 100644 index 0000000..16e8457 --- /dev/null +++ b/Tests/RunCMake/File_Generate/Target.cmake @@ -0,0 +1,2 @@ +add_subdirectory(sub1) +add_subdirectory(sub2) diff --git a/Tests/RunCMake/File_Generate/sub1/CMakeLists.txt b/Tests/RunCMake/File_Generate/sub1/CMakeLists.txt new file mode 100644 index 0000000..34c51a4 --- /dev/null +++ b/Tests/RunCMake/File_Generate/sub1/CMakeLists.txt @@ -0,0 +1,7 @@ +add_library(library IMPORTED STATIC) +set_property(TARGET library PROPERTY COMPILE_DEFINITIONS "first") + +file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/output.txt" + CONTENT "$<TARGET_PROPERTY:COMPILE_DEFINITIONS>" + TARGET library +) diff --git a/Tests/RunCMake/File_Generate/sub2/CMakeLists.txt b/Tests/RunCMake/File_Generate/sub2/CMakeLists.txt new file mode 100644 index 0000000..09b81ac --- /dev/null +++ b/Tests/RunCMake/File_Generate/sub2/CMakeLists.txt @@ -0,0 +1,7 @@ +add_library(library IMPORTED STATIC) +set_property(TARGET library PROPERTY COMPILE_DEFINITIONS "second") + +file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/output.txt" + CONTENT "$<TARGET_PROPERTY:COMPILE_DEFINITIONS>" + TARGET library +) 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/GoogleTest/GoogleTest-discovery-PRE_TEST-timeout-test-result.txt b/Tests/RunCMake/GoogleTest/GoogleTest-discovery-PRE_TEST-timeout-test-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/GoogleTest/GoogleTest-discovery-PRE_TEST-timeout-test-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/Graphviz/GraphvizTestProject.cmake b/Tests/RunCMake/Graphviz/GraphvizTestProject.cmake index 4ce6b5c..2c7d5bf 100644 --- a/Tests/RunCMake/Graphviz/GraphvizTestProject.cmake +++ b/Tests/RunCMake/Graphviz/GraphvizTestProject.cmake @@ -60,7 +60,10 @@ target_link_libraries(ConsoleApplication CoreLibrary) # No one will ever notice... add_library(CryptoCurrencyMiningLibrary UNKNOWN IMPORTED) +set_target_properties(CryptoCurrencyMiningLibrary PROPERTIES IMPORTED_LOCATION "cryptomining${CMAKE_STATIC_LIBRARY_SUFFIX}") target_link_libraries(ConsoleApplication CryptoCurrencyMiningLibrary) add_custom_target(GenerateManPage COMMAND ${CMAKE_COMMAND} --version) add_dependencies(ConsoleApplication GenerateManPage) + +add_subdirectory(sub_directory_target) diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_custom_targets.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_custom_targets.dot index 31d88df..a9e664a 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_custom_targets.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_custom_targets.dot @@ -52,4 +52,5 @@ subgraph clusterLegend { "node12" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; "node12" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags "node12" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node13" [ label = "SubDirectoryTarget", shape = egg ]; } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_default_options.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_default_options.dot index 26f2f64..06cdb75 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_default_options.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_default_options.dot @@ -50,4 +50,5 @@ subgraph clusterLegend { "node11" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; "node11" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags "node11" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node12" [ label = "SubDirectoryTarget", shape = egg ]; } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_dependers_files.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_dependers_files.dot index 26f2f64..06cdb75 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_dependers_files.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_dependers_files.dot @@ -50,4 +50,5 @@ subgraph clusterLegend { "node11" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; "node11" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags "node11" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node12" [ label = "SubDirectoryTarget", shape = egg ]; } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_external_libs.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_external_libs.dot index db675a8..490450e 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_external_libs.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_external_libs.dot @@ -46,4 +46,5 @@ subgraph clusterLegend { "node9" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; "node9" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags "node9" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node10" [ label = "SubDirectoryTarget", shape = egg ]; } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_graphic_libs.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_graphic_libs.dot index 234ee39..086c849 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_graphic_libs.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_graphic_libs.dot @@ -35,4 +35,5 @@ subgraph clusterLegend { "node5" [ label = "CryptoCurrencyMiningLibrary", shape = septagon ]; "node1" -> "node5" [ style = dotted ] // ConsoleApplication -> CryptoCurrencyMiningLibrary "node6" [ label = "\"-lm\"", shape = septagon ]; + "node7" [ label = "SubDirectoryTarget", shape = egg ]; } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_interface_libs.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_interface_libs.dot index 6dea88c..350f0f1 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_interface_libs.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_interface_libs.dot @@ -43,4 +43,5 @@ subgraph clusterLegend { "node8" -> "node1" [ style = dotted ] // GraphicDriverOpenGL -> CoreLibrary "node9" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; "node9" -> "node1" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node10" [ label = "SubDirectoryTarget", shape = egg ]; } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_module_libs.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_module_libs.dot index df3d10a..fd351d0 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_module_libs.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_module_libs.dot @@ -44,4 +44,5 @@ subgraph clusterLegend { "node9" [ label = "GraphicLibraryObjects", shape = hexagon ]; "node7" -> "node9" [ style = dotted ] // GraphicLibrary -> GraphicLibraryObjects "node6" -> "node7" [ style = dotted ] // GraphicApplication -> GraphicLibrary + "node10" [ label = "SubDirectoryTarget", shape = egg ]; } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_object_libs.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_object_libs.dot index 8f832a8..39a2a03 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_object_libs.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_object_libs.dot @@ -48,4 +48,5 @@ subgraph clusterLegend { "node10" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; "node10" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags "node10" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node11" [ label = "SubDirectoryTarget", shape = egg ]; } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_per_target_files.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_per_target_files.dot index 26f2f64..06cdb75 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_per_target_files.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_per_target_files.dot @@ -50,4 +50,5 @@ subgraph clusterLegend { "node11" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; "node11" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags "node11" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node12" [ label = "SubDirectoryTarget", shape = egg ]; } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_shared_libs.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_shared_libs.dot index e127daa..d949d87 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_shared_libs.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_shared_libs.dot @@ -44,4 +44,5 @@ subgraph clusterLegend { "node10" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; "node10" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags "node10" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node11" [ label = "SubDirectoryTarget", shape = egg ]; } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_static_libs.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_static_libs.dot index 81199a2..e9b9570 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_static_libs.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_static_libs.dot @@ -39,4 +39,5 @@ subgraph clusterLegend { "node8" -> "node0" [ style = dotted ] // GraphicDriverOpenGL -> CompilerFlags "node9" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; "node9" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags + "node10" [ label = "SubDirectoryTarget", shape = egg ]; } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_unknown_libs.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_unknown_libs.dot index 4f242bb..7db111c 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_unknown_libs.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_no_unknown_libs.dot @@ -48,4 +48,5 @@ subgraph clusterLegend { "node10" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; "node10" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags "node10" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node11" [ label = "SubDirectoryTarget", shape = egg ]; } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_graph_header.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_graph_header.dot index c664af8..f664c2e 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_graph_header.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_graph_header.dot @@ -50,4 +50,5 @@ subgraph clusterLegend { "node11" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; "node11" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags "node11" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node12" [ label = "SubDirectoryTarget", shape = egg ]; } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_graph_name.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_graph_name.dot index 5579306..58dda6d 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_graph_name.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_graph_name.dot @@ -50,4 +50,5 @@ subgraph clusterLegend { "node11" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; "node11" -> "node0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags "node11" -> "node2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "node12" [ label = "SubDirectoryTarget", shape = egg ]; } diff --git a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_node_prefix.dot b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_node_prefix.dot index 3bf20ec..8b93f7c 100644 --- a/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_node_prefix.dot +++ b/Tests/RunCMake/Graphviz/expected_outputs/dependency_graph_set_node_prefix.dot @@ -50,4 +50,5 @@ subgraph clusterLegend { "point11" [ label = "GraphicDriverVulkan", shape = tripleoctagon ]; "point11" -> "point0" [ style = dotted ] // GraphicDriverVulkan -> CompilerFlags "point11" -> "point2" [ style = dotted ] // GraphicDriverVulkan -> CoreLibrary + "point12" [ label = "SubDirectoryTarget", shape = egg ]; } diff --git a/Tests/RunCMake/Graphviz/sub_directory_target/CMakeLists.txt b/Tests/RunCMake/Graphviz/sub_directory_target/CMakeLists.txt new file mode 100644 index 0000000..d84897b --- /dev/null +++ b/Tests/RunCMake/Graphviz/sub_directory_target/CMakeLists.txt @@ -0,0 +1 @@ +add_executable(SubDirectoryTarget test.c) diff --git a/Tests/RunCMake/Graphviz/sub_directory_target/test.c b/Tests/RunCMake/Graphviz/sub_directory_target/test.c new file mode 100644 index 0000000..d123e09 --- /dev/null +++ b/Tests/RunCMake/Graphviz/sub_directory_target/test.c @@ -0,0 +1,4 @@ +int main(int argc, char** argv) +{ + return 0; +} 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-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/Win32GenEx/CMakeLists.txt b/Tests/RunCMake/Win32GenEx/CMakeLists.txt new file mode 100644 index 0000000..b646c4a --- /dev/null +++ b/Tests/RunCMake/Win32GenEx/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/Win32GenEx/RunCMakeTest.cmake b/Tests/RunCMake/Win32GenEx/RunCMakeTest.cmake new file mode 100644 index 0000000..d5529b0 --- /dev/null +++ b/Tests/RunCMake/Win32GenEx/RunCMakeTest.cmake @@ -0,0 +1,28 @@ +include(RunCMake) + +if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Win32GenEx-build) + run_cmake(Win32GenEx) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(Win32GenEx-debug-build ${CMAKE_COMMAND} --build ${RunCMake_TEST_BINARY_DIR} --config Debug) + run_cmake_command(Win32GenEx-release-build ${CMAKE_COMMAND} --build ${RunCMake_TEST_BINARY_DIR} --config Release) + unset(RunCMake_TEST_NO_CLEAN) +else() + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Win32GenEx-debug-build) + set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug) + run_cmake(Win32GenEx-debug) + unset(RunCMake_TEST_OPTIONS) + + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(Win32GenEx-debug-build ${CMAKE_COMMAND} --build ${RunCMake_TEST_BINARY_DIR}) + unset(RunCMake_TEST_NO_CLEAN) + + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Win32GenEx-release-build) + set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Release) + run_cmake(Win32GenEx-release) + unset(RunCMake_TEST_OPTIONS) + + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(Win32GenEx-release-build ${CMAKE_COMMAND} --build ${RunCMake_TEST_BINARY_DIR}) + unset(RunCMake_TEST_NO_CLEAN) +endif() diff --git a/Tests/RunCMake/Win32GenEx/Win32GenEx-debug.cmake b/Tests/RunCMake/Win32GenEx/Win32GenEx-debug.cmake new file mode 100644 index 0000000..74c5bd8 --- /dev/null +++ b/Tests/RunCMake/Win32GenEx/Win32GenEx-debug.cmake @@ -0,0 +1 @@ +include(Win32GenEx.cmake) diff --git a/Tests/RunCMake/Win32GenEx/Win32GenEx-release.cmake b/Tests/RunCMake/Win32GenEx/Win32GenEx-release.cmake new file mode 100644 index 0000000..74c5bd8 --- /dev/null +++ b/Tests/RunCMake/Win32GenEx/Win32GenEx-release.cmake @@ -0,0 +1 @@ +include(Win32GenEx.cmake) diff --git a/Tests/RunCMake/Win32GenEx/Win32GenEx.cmake b/Tests/RunCMake/Win32GenEx/Win32GenEx.cmake new file mode 100644 index 0000000..80f8b80 --- /dev/null +++ b/Tests/RunCMake/Win32GenEx/Win32GenEx.cmake @@ -0,0 +1,7 @@ +enable_language(C) + +add_executable(Win32GenEx main.c) +set_target_properties(Win32GenEx PROPERTIES + WIN32_EXECUTABLE $<CONFIG:Release> + ) +target_compile_definitions(Win32GenEx PRIVATE $<$<CONFIG:Release>:USE_WIN32_MAIN>) diff --git a/Tests/RunCMake/Win32GenEx/main.c b/Tests/RunCMake/Win32GenEx/main.c new file mode 100644 index 0000000..1cf9f81 --- /dev/null +++ b/Tests/RunCMake/Win32GenEx/main.c @@ -0,0 +1,14 @@ +#ifdef USE_WIN32_MAIN +# include <windows.h> + +int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpCmdLine, int nShowCmd) +{ + return 0; +} +#else +int main(void) +{ + return 0; +} +#endif 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..ed300bb 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) @@ -309,10 +310,10 @@ endif() if(XCODE_VERSION VERSION_GREATER_EQUAL 8) function(XcodeRemoveExcessiveISystemSDK SDK) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeRemoveExcessiveISystemSDK-${SDK}-build) - set(RunCMake_TEST_OPTIONS "-DCMAKE_SYSTEM_NAME=iOS") + set(RunCMake_TEST_OPTIONS "-DCMAKE_SYSTEM_NAME=iOS" "-DCMAKE_OSX_SYSROOT=${SDK}") run_cmake(XcodeRemoveExcessiveISystem) set(RunCMake_TEST_NO_CLEAN 1) - run_cmake_command(XcodeRemoveExcessiveISystemSDK-${SDK}-build ${CMAKE_COMMAND} --build . -- -sdk ${SDK}) + run_cmake_command(XcodeRemoveExcessiveISystemSDK-${SDK}-build ${CMAKE_COMMAND} --build .) endfunction() XcodeRemoveExcessiveISystemSDK(iphoneos) 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/XcodeProject/main.cpp b/Tests/RunCMake/XcodeProject/main.cpp index c94753f..f8b643a 100644 --- a/Tests/RunCMake/XcodeProject/main.cpp +++ b/Tests/RunCMake/XcodeProject/main.cpp @@ -1,4 +1,4 @@ -int main(int argc, const char* argv[]) +int main() { return 0; } diff --git a/Tests/RunCMake/XcodeProject/main.m b/Tests/RunCMake/XcodeProject/main.m index 6dc190a..3e70e50 100644 --- a/Tests/RunCMake/XcodeProject/main.m +++ b/Tests/RunCMake/XcodeProject/main.m @@ -1,3 +1,3 @@ -int main(int argc, const char * argv[]) { +int main(void) { return 1; } diff --git a/Tests/RunCMake/add_test/CMP0110-Common-AlphaNumeric.cmake b/Tests/RunCMake/add_test/CMP0110-Common-AlphaNumeric.cmake new file mode 100644 index 0000000..c2ab433 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-Common-AlphaNumeric.cmake @@ -0,0 +1,2 @@ +set(TEST_NAME "abcdefghijklmnopqrstuvwxyz0123456789") +include(CMP0110-Common.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-Common-BracketArgument.cmake b/Tests/RunCMake/add_test/CMP0110-Common-BracketArgument.cmake new file mode 100644 index 0000000..77cd3eb --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-Common-BracketArgument.cmake @@ -0,0 +1,2 @@ +set(TEST_NAME "[=[InBracketBeforeSemi;InBracketAfterSemi]=]") +include(CMP0110-Common.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-Common-EscapedSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-Common-EscapedSpecialChars.cmake new file mode 100644 index 0000000..268b622 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-Common-EscapedSpecialChars.cmake @@ -0,0 +1,2 @@ +set(TEST_NAME \(\)\ \# ) +include(CMP0110-Common.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-Common-FormerInvalidSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-Common-FormerInvalidSpecialChars.cmake new file mode 100644 index 0000000..65bca10 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-Common-FormerInvalidSpecialChars.cmake @@ -0,0 +1,2 @@ +set(TEST_NAME "$[] #;\t\n\"\\") +include(CMP0110-Common.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-Common-LeadingAndTrailingWhitespace.cmake b/Tests/RunCMake/add_test/CMP0110-Common-LeadingAndTrailingWhitespace.cmake new file mode 100644 index 0000000..ec90e13 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-Common-LeadingAndTrailingWhitespace.cmake @@ -0,0 +1,2 @@ +set(TEST_NAME " SurroundedByWhitespace ") +include(CMP0110-Common.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-Common-OtherSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-Common-OtherSpecialChars.cmake new file mode 100644 index 0000000..f74c3b5 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-Common-OtherSpecialChars.cmake @@ -0,0 +1,2 @@ +set(TEST_NAME "!§%&/ü:*😤~") +include(CMP0110-Common.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-Common-Quote.cmake b/Tests/RunCMake/add_test/CMP0110-Common-Quote.cmake new file mode 100644 index 0000000..a1ddb66 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-Common-Quote.cmake @@ -0,0 +1,2 @@ +set(TEST_NAME "BeforeQuote\"\"AfterEscapedQuote") +include(CMP0110-Common.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-Common-Semicolon.cmake b/Tests/RunCMake/add_test/CMP0110-Common-Semicolon.cmake new file mode 100644 index 0000000..11fd4fb --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-Common-Semicolon.cmake @@ -0,0 +1,2 @@ +set(TEST_NAME "BeforeSemi;AfterSemi") +include(CMP0110-Common.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-Common-Space.cmake b/Tests/RunCMake/add_test/CMP0110-Common-Space.cmake new file mode 100644 index 0000000..38dd28e --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-Common-Space.cmake @@ -0,0 +1,2 @@ +set(TEST_NAME "BeforeSpace AfterSpace") +include(CMP0110-Common.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-Common-ValidSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-Common-ValidSpecialChars.cmake new file mode 100644 index 0000000..bfd082b --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-Common-ValidSpecialChars.cmake @@ -0,0 +1,2 @@ +set(TEST_NAME "abc_.+-012") +include(CMP0110-Common.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-Common.cmake b/Tests/RunCMake/add_test/CMP0110-Common.cmake new file mode 100644 index 0000000..915d171 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-Common.cmake @@ -0,0 +1,9 @@ +include(CTest) +add_test( + NAME "${TEST_NAME}" + COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_LIST_DIR}/CMP0110-Test.cmake" +) +set_property( + TEST "${TEST_NAME}" + PROPERTY ENVIRONMENT CMAKE_add_test_ENVVAR=1 +) diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-AlphaNumeric-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-NEW-AlphaNumeric-ctest-stdout.txt new file mode 100644 index 0000000..ed939bf --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-AlphaNumeric-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: abcdefghijklmnopqrstuvwxyz0123456789 \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-AlphaNumeric.cmake b/Tests/RunCMake/add_test/CMP0110-NEW-AlphaNumeric.cmake new file mode 100644 index 0000000..7ea7042 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-AlphaNumeric.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 NEW) +include(CMP0110-Common-AlphaNumeric.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-BracketArgument-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-NEW-BracketArgument-ctest-stdout.txt new file mode 100644 index 0000000..7364d56 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-BracketArgument-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: \[=\[InBracketBeforeSemi;InBracketAfterSemi\]=\] \.+[ ]+Passed diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-BracketArgument.cmake b/Tests/RunCMake/add_test/CMP0110-NEW-BracketArgument.cmake new file mode 100644 index 0000000..baef07c --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-BracketArgument.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 NEW) +include(CMP0110-Common-BracketArgument.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-EscapedSpecialChars-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-NEW-EscapedSpecialChars-ctest-stdout.txt new file mode 100644 index 0000000..80435b6 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-EscapedSpecialChars-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: \(\) # \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-EscapedSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-NEW-EscapedSpecialChars.cmake new file mode 100644 index 0000000..c9b06bd --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-EscapedSpecialChars.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 NEW) +include(CMP0110-Common-EscapedSpecialChars.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-FormerInvalidSpecialChars-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-NEW-FormerInvalidSpecialChars-ctest-stdout.txt new file mode 100644 index 0000000..5ad8694 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-FormerInvalidSpecialChars-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: \$\[\] .+[ ]*Passed diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-FormerInvalidSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-NEW-FormerInvalidSpecialChars.cmake new file mode 100644 index 0000000..86ddf14 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-FormerInvalidSpecialChars.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 NEW) +include(CMP0110-Common-FormerInvalidSpecialChars.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-FormerInvalidSpecialCharsMC.cmake b/Tests/RunCMake/add_test/CMP0110-NEW-FormerInvalidSpecialCharsMC.cmake new file mode 100644 index 0000000..f9b556a --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-FormerInvalidSpecialCharsMC.cmake @@ -0,0 +1 @@ +include(CMP0110-NEW-FormerInvalidSpecialChars.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-GeneratorExpressionSyntax.cmake b/Tests/RunCMake/add_test/CMP0110-NEW-GeneratorExpressionSyntax.cmake new file mode 100644 index 0000000..0790536 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-GeneratorExpressionSyntax.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 NEW) +include(CMP0110-Common-GeneratorExpressionSyntax.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-LeadingAndTrailingWhitespace-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-NEW-LeadingAndTrailingWhitespace-ctest-stdout.txt new file mode 100644 index 0000000..78379cd --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-LeadingAndTrailingWhitespace-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: [ ]SurroundedByWhitespace[ ] \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-LeadingAndTrailingWhitespace.cmake b/Tests/RunCMake/add_test/CMP0110-NEW-LeadingAndTrailingWhitespace.cmake new file mode 100644 index 0000000..2d636a8 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-LeadingAndTrailingWhitespace.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 NEW) +include(CMP0110-Common-LeadingAndTrailingWhitespace.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-OtherSpecialChars-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-NEW-OtherSpecialChars-ctest-stdout.txt new file mode 100644 index 0000000..8ee3ea9 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-OtherSpecialChars-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: !§%&/ü:\*😤~ \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-OtherSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-NEW-OtherSpecialChars.cmake new file mode 100644 index 0000000..d77a6ce --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-OtherSpecialChars.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 NEW) +include(CMP0110-Common-OtherSpecialChars.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-Quote-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-NEW-Quote-ctest-stdout.txt new file mode 100644 index 0000000..23dafd4 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-Quote-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: BeforeQuote""AfterEscapedQuote \.+[ ]+Passed diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-Quote.cmake b/Tests/RunCMake/add_test/CMP0110-NEW-Quote.cmake new file mode 100644 index 0000000..2e7a6e1 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-Quote.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 NEW) +include(CMP0110-Common-Quote.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-Semicolon.cmake b/Tests/RunCMake/add_test/CMP0110-NEW-Semicolon.cmake new file mode 100644 index 0000000..1c6e1b1 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-Semicolon.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 NEW) +include(CMP0110-Common-Semicolon.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-Space.cmake b/Tests/RunCMake/add_test/CMP0110-NEW-Space.cmake new file mode 100644 index 0000000..38afb85 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-Space.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 NEW) +include(CMP0110-Common-Space.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-ValidSpecialChars-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-NEW-ValidSpecialChars-ctest-stdout.txt new file mode 100644 index 0000000..ae1a0b1 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-ValidSpecialChars-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: abc_\.\+-012 \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-ValidSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-NEW-ValidSpecialChars.cmake new file mode 100644 index 0000000..62bb638 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-ValidSpecialChars.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 NEW) +include(CMP0110-Common-ValidSpecialChars.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-AlphaNumeric-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-OLD-AlphaNumeric-ctest-stdout.txt new file mode 100644 index 0000000..ed939bf --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-AlphaNumeric-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: abcdefghijklmnopqrstuvwxyz0123456789 \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-AlphaNumeric.cmake b/Tests/RunCMake/add_test/CMP0110-OLD-AlphaNumeric.cmake new file mode 100644 index 0000000..bf4e82b --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-AlphaNumeric.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 OLD) +include(CMP0110-Common-AlphaNumeric.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-BracketArgument-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-OLD-BracketArgument-ctest-stdout.txt new file mode 100644 index 0000000..093f5d4 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-BracketArgument-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: InBracketBeforeSemi;InBracketAfterSemi \.+[ ]+Passed diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-BracketArgument.cmake b/Tests/RunCMake/add_test/CMP0110-OLD-BracketArgument.cmake new file mode 100644 index 0000000..05dfeb4 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-BracketArgument.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 OLD) +include(CMP0110-Common-BracketArgument.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-EscapedSpecialChars-ctest-result.txt b/Tests/RunCMake/add_test/CMP0110-OLD-EscapedSpecialChars-ctest-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-EscapedSpecialChars-ctest-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-EscapedSpecialChars-ctest-stderr.txt b/Tests/RunCMake/add_test/CMP0110-OLD-EscapedSpecialChars-ctest-stderr.txt new file mode 100644 index 0000000..296e426 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-EscapedSpecialChars-ctest-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at CTestTestfile.cmake:[0-9]+: + Parse error\. Function missing ending "\)"\. End of file reached\. + + +Errors while running CTest diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-EscapedSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-OLD-EscapedSpecialChars.cmake new file mode 100644 index 0000000..1f0c99f --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-EscapedSpecialChars.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 OLD) +include(CMP0110-Common-EscapedSpecialChars.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialChars-ctest-result.txt b/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialChars-ctest-result.txt new file mode 100644 index 0000000..45a4fb7 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialChars-ctest-result.txt @@ -0,0 +1 @@ +8 diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialChars-ctest-stderr.txt b/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialChars-ctest-stderr.txt new file mode 100644 index 0000000..c656b4c --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialChars-ctest-stderr.txt @@ -0,0 +1 @@ +Unable to find executable: diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialChars-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialChars-ctest-stdout.txt new file mode 100644 index 0000000..d3b0fac --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialChars-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: \$\[\] \.+\*\*\*Not Run diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialChars.cmake new file mode 100644 index 0000000..883c5b6 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialChars.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 OLD) +include(CMP0110-Common-FormerInvalidSpecialChars.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialCharsMC-ctest-result.txt b/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialCharsMC-ctest-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialCharsMC-ctest-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialCharsMC-ctest-stderr.txt b/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialCharsMC-ctest-stderr.txt new file mode 100644 index 0000000..06ad927 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialCharsMC-ctest-stderr.txt @@ -0,0 +1,3 @@ +CMake Error at CTestTestfile.cmake:[0-9]+: + Parse error. Function missing ending "\)". Instead found unterminated + string with text "\\ NOT_AVAILABLE\) diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialCharsMC.cmake b/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialCharsMC.cmake new file mode 100644 index 0000000..47e03bc --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialCharsMC.cmake @@ -0,0 +1 @@ +include(CMP0110-OLD-FormerInvalidSpecialChars.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-GeneratorExpressionSyntax.cmake b/Tests/RunCMake/add_test/CMP0110-OLD-GeneratorExpressionSyntax.cmake new file mode 100644 index 0000000..7ee6b50 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-GeneratorExpressionSyntax.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 OLD) +include(CMP0110-Common-GeneratorExpressionSyntax.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-LeadingAndTrailingWhitespace-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-OLD-LeadingAndTrailingWhitespace-ctest-stdout.txt new file mode 100644 index 0000000..870483e --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-LeadingAndTrailingWhitespace-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: SurroundedByWhitespace \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-LeadingAndTrailingWhitespace.cmake b/Tests/RunCMake/add_test/CMP0110-OLD-LeadingAndTrailingWhitespace.cmake new file mode 100644 index 0000000..a20d211 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-LeadingAndTrailingWhitespace.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 OLD) +include(CMP0110-Common-LeadingAndTrailingWhitespace.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-OtherSpecialChars-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-OLD-OtherSpecialChars-ctest-stdout.txt new file mode 100644 index 0000000..8ee3ea9 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-OtherSpecialChars-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: !§%&/ü:\*😤~ \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-OtherSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-OLD-OtherSpecialChars.cmake new file mode 100644 index 0000000..0e88183 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-OtherSpecialChars.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 OLD) +include(CMP0110-Common-OtherSpecialChars.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-Quote-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-OLD-Quote-ctest-stdout.txt new file mode 100644 index 0000000..23dafd4 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-Quote-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: BeforeQuote""AfterEscapedQuote \.+[ ]+Passed diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-Quote.cmake b/Tests/RunCMake/add_test/CMP0110-OLD-Quote.cmake new file mode 100644 index 0000000..c910a7c --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-Quote.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 OLD) +include(CMP0110-Common-Quote.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-Semicolon-ctest-result.txt b/Tests/RunCMake/add_test/CMP0110-OLD-Semicolon-ctest-result.txt new file mode 100644 index 0000000..45a4fb7 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-Semicolon-ctest-result.txt @@ -0,0 +1 @@ +8 diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-Semicolon-ctest-stderr.txt b/Tests/RunCMake/add_test/CMP0110-OLD-Semicolon-ctest-stderr.txt new file mode 100644 index 0000000..0d43768 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-Semicolon-ctest-stderr.txt @@ -0,0 +1 @@ +Unable to find executable: AfterSemi diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-Semicolon-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-OLD-Semicolon-ctest-stdout.txt new file mode 100644 index 0000000..0a6ebed --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-Semicolon-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: BeforeSemi \.+\*\*\*Not Run diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-Semicolon.cmake b/Tests/RunCMake/add_test/CMP0110-OLD-Semicolon.cmake new file mode 100644 index 0000000..283aeed --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-Semicolon.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 OLD) +include(CMP0110-Common-Semicolon.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-Space-ctest-result.txt b/Tests/RunCMake/add_test/CMP0110-OLD-Space-ctest-result.txt new file mode 100644 index 0000000..45a4fb7 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-Space-ctest-result.txt @@ -0,0 +1 @@ +8 diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-Space-ctest-stderr.txt b/Tests/RunCMake/add_test/CMP0110-OLD-Space-ctest-stderr.txt new file mode 100644 index 0000000..2ded1d4 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-Space-ctest-stderr.txt @@ -0,0 +1 @@ +Unable to find executable: AfterSpace diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-Space-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-OLD-Space-ctest-stdout.txt new file mode 100644 index 0000000..059c625 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-Space-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: BeforeSpace \.+\*\*\*Not Run diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-Space.cmake b/Tests/RunCMake/add_test/CMP0110-OLD-Space.cmake new file mode 100644 index 0000000..46f7c26 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-Space.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 OLD) +include(CMP0110-Common-Space.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-ValidSpecialChars-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-OLD-ValidSpecialChars-ctest-stdout.txt new file mode 100644 index 0000000..ae1a0b1 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-ValidSpecialChars-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: abc_\.\+-012 \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-ValidSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-OLD-ValidSpecialChars.cmake new file mode 100644 index 0000000..ffc6462 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-ValidSpecialChars.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 OLD) +include(CMP0110-Common-ValidSpecialChars.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-Test.cmake b/Tests/RunCMake/add_test/CMP0110-Test.cmake new file mode 100644 index 0000000..3f1dfad --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-Test.cmake @@ -0,0 +1,3 @@ +if(NOT DEFINED ENV{CMAKE_add_test_ENVVAR}) + message(FATAL_ERROR "Setting property on test did not succeed!") +endif() diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-AlphaNumeric-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-WARN-AlphaNumeric-ctest-stdout.txt new file mode 100644 index 0000000..ed939bf --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-AlphaNumeric-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: abcdefghijklmnopqrstuvwxyz0123456789 \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-AlphaNumeric.cmake b/Tests/RunCMake/add_test/CMP0110-WARN-AlphaNumeric.cmake new file mode 100644 index 0000000..d2af2aa --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-AlphaNumeric.cmake @@ -0,0 +1,2 @@ +# CMP0110 not set +include(CMP0110-Common-AlphaNumeric.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-BracketArgument-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-WARN-BracketArgument-ctest-stdout.txt new file mode 100644 index 0000000..093f5d4 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-BracketArgument-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: InBracketBeforeSemi;InBracketAfterSemi \.+[ ]+Passed diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-BracketArgument-stderr.txt b/Tests/RunCMake/add_test/CMP0110-WARN-BracketArgument-stderr.txt new file mode 100644 index 0000000..19e60c1 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-BracketArgument-stderr.txt @@ -0,0 +1,11 @@ +CMake Warning \(dev\) in CMakeLists\.txt: + Policy CMP0110 is not set: add_test\(\) supports arbitrary characters in test + names\. Run "cmake --help-policy CMP0110" for policy details\. Use the + cmake_policy command to set the policy and suppress this warning\. + + The following name given to add_test\(\) is invalid if CMP0110 is not set or + set to OLD: + + `\[=\[InBracketBeforeSemi;InBracketAfterSemi\]=\]´ + +This warning is for project developers\. Use -Wno-dev to suppress it\. diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-BracketArgument.cmake b/Tests/RunCMake/add_test/CMP0110-WARN-BracketArgument.cmake new file mode 100644 index 0000000..7887658 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-BracketArgument.cmake @@ -0,0 +1,2 @@ +# CMP0110 not set +include(CMP0110-Common-BracketArgument.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars-ctest-result.txt b/Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars-ctest-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars-ctest-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars-ctest-stderr.txt b/Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars-ctest-stderr.txt new file mode 100644 index 0000000..296e426 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars-ctest-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at CTestTestfile.cmake:[0-9]+: + Parse error\. Function missing ending "\)"\. End of file reached\. + + +Errors while running CTest diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars-stderr.txt b/Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars-stderr.txt new file mode 100644 index 0000000..057f2d6 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars-stderr.txt @@ -0,0 +1,11 @@ +CMake Warning \(dev\) in CMakeLists\.txt: + Policy CMP0110 is not set: add_test\(\) supports arbitrary characters in test + names\. Run "cmake --help-policy CMP0110" for policy details\. Use the + cmake_policy command to set the policy and suppress this warning\. + + The following name given to add_test\(\) is invalid if CMP0110 is not set or + set to OLD: + + `\(\) #´ + +This warning is for project developers\. Use -Wno-dev to suppress it\. diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars.cmake new file mode 100644 index 0000000..ca27462 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars.cmake @@ -0,0 +1,2 @@ +# CMP0110 not set +include(CMP0110-Common-EscapedSpecialChars.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars-ctest-result.txt b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars-ctest-result.txt new file mode 100644 index 0000000..45a4fb7 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars-ctest-result.txt @@ -0,0 +1 @@ +8 diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars-ctest-stderr.txt b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars-ctest-stderr.txt new file mode 100644 index 0000000..c656b4c --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars-ctest-stderr.txt @@ -0,0 +1 @@ +Unable to find executable: diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars-ctest-stdout.txt new file mode 100644 index 0000000..d3b0fac --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: \$\[\] \.+\*\*\*Not Run diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars-stderr.txt b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars-stderr.txt new file mode 100644 index 0000000..4f20ab9 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars-stderr.txt @@ -0,0 +1,13 @@ +CMake Warning \(dev\) in CMakeLists\.txt: + Policy CMP0110 is not set: add_test\(\) supports arbitrary characters in test + names\. Run "cmake --help-policy CMP0110" for policy details\. Use the + cmake_policy command to set the policy and suppress this warning\. + + The following name given to add_test\(\) is invalid if CMP0110 is not set or + set to OLD: + + `\$\[\] #;[ ] + + "\\´ + +This warning is for project developers\. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars.cmake new file mode 100644 index 0000000..3b689c2 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars.cmake @@ -0,0 +1,2 @@ +# CMP0110 not set +include(CMP0110-Common-FormerInvalidSpecialChars.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialCharsMC-ctest-result.txt b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialCharsMC-ctest-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialCharsMC-ctest-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialCharsMC-ctest-stderr.txt b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialCharsMC-ctest-stderr.txt new file mode 100644 index 0000000..06ad927 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialCharsMC-ctest-stderr.txt @@ -0,0 +1,3 @@ +CMake Error at CTestTestfile.cmake:[0-9]+: + Parse error. Function missing ending "\)". Instead found unterminated + string with text "\\ NOT_AVAILABLE\) diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialCharsMC-stderr.txt b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialCharsMC-stderr.txt new file mode 100644 index 0000000..4f20ab9 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialCharsMC-stderr.txt @@ -0,0 +1,13 @@ +CMake Warning \(dev\) in CMakeLists\.txt: + Policy CMP0110 is not set: add_test\(\) supports arbitrary characters in test + names\. Run "cmake --help-policy CMP0110" for policy details\. Use the + cmake_policy command to set the policy and suppress this warning\. + + The following name given to add_test\(\) is invalid if CMP0110 is not set or + set to OLD: + + `\$\[\] #;[ ] + + "\\´ + +This warning is for project developers\. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialCharsMC.cmake b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialCharsMC.cmake new file mode 100644 index 0000000..f77ff5c --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialCharsMC.cmake @@ -0,0 +1 @@ +include(CMP0110-WARN-FormerInvalidSpecialChars.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-GeneratorExpressionSyntax.cmake b/Tests/RunCMake/add_test/CMP0110-WARN-GeneratorExpressionSyntax.cmake new file mode 100644 index 0000000..77c9ed2 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-GeneratorExpressionSyntax.cmake @@ -0,0 +1,2 @@ +# CMP0110 not set +include(CMP0110-Common-GeneratorExpressionSyntax.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-LeadingAndTrailingWhitespace-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-WARN-LeadingAndTrailingWhitespace-ctest-stdout.txt new file mode 100644 index 0000000..870483e --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-LeadingAndTrailingWhitespace-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: SurroundedByWhitespace \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-LeadingAndTrailingWhitespace-stderr.txt b/Tests/RunCMake/add_test/CMP0110-WARN-LeadingAndTrailingWhitespace-stderr.txt new file mode 100644 index 0000000..a392fed --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-LeadingAndTrailingWhitespace-stderr.txt @@ -0,0 +1,11 @@ +CMake Warning \(dev\) in CMakeLists\.txt: + Policy CMP0110 is not set: add_test\(\) supports arbitrary characters in test + names\. Run "cmake --help-policy CMP0110" for policy details\. Use the + cmake_policy command to set the policy and suppress this warning\. + + The following name given to add_test\(\) is invalid if CMP0110 is not set or + set to OLD: + + ` SurroundedByWhitespace ´ + +This warning is for project developers\. Use -Wno-dev to suppress it\. diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-LeadingAndTrailingWhitespace.cmake b/Tests/RunCMake/add_test/CMP0110-WARN-LeadingAndTrailingWhitespace.cmake new file mode 100644 index 0000000..322bb4a --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-LeadingAndTrailingWhitespace.cmake @@ -0,0 +1,2 @@ +# CMP0110 not set +include(CMP0110-Common-LeadingAndTrailingWhitespace.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-OtherSpecialChars-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-WARN-OtherSpecialChars-ctest-stdout.txt new file mode 100644 index 0000000..8ee3ea9 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-OtherSpecialChars-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: !§%&/ü:\*😤~ \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-OtherSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-WARN-OtherSpecialChars.cmake new file mode 100644 index 0000000..19fa6e6 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-OtherSpecialChars.cmake @@ -0,0 +1,2 @@ +# CMP0110 not set +include(CMP0110-Common-OtherSpecialChars.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-Quote-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-WARN-Quote-ctest-stdout.txt new file mode 100644 index 0000000..23dafd4 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-Quote-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: BeforeQuote""AfterEscapedQuote \.+[ ]+Passed diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-Quote-stderr.txt b/Tests/RunCMake/add_test/CMP0110-WARN-Quote-stderr.txt new file mode 100644 index 0000000..39f3a92 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-Quote-stderr.txt @@ -0,0 +1,11 @@ +CMake Warning \(dev\) in CMakeLists\.txt: + Policy CMP0110 is not set: add_test\(\) supports arbitrary characters in test + names\. Run "cmake --help-policy CMP0110" for policy details\. Use the + cmake_policy command to set the policy and suppress this warning\. + + The following name given to add_test\(\) is invalid if CMP0110 is not set or + set to OLD: + + `BeforeQuote""AfterEscapedQuote´ + +This warning is for project developers\. Use -Wno-dev to suppress it\. diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-Quote.cmake b/Tests/RunCMake/add_test/CMP0110-WARN-Quote.cmake new file mode 100644 index 0000000..33aaad0 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-Quote.cmake @@ -0,0 +1,2 @@ +# CMP0110 not set +include(CMP0110-Common-Quote.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon-ctest-result.txt b/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon-ctest-result.txt new file mode 100644 index 0000000..45a4fb7 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon-ctest-result.txt @@ -0,0 +1 @@ +8 diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon-ctest-stderr.txt b/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon-ctest-stderr.txt new file mode 100644 index 0000000..0d43768 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon-ctest-stderr.txt @@ -0,0 +1 @@ +Unable to find executable: AfterSemi diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon-ctest-stdout.txt new file mode 100644 index 0000000..0a6ebed --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: BeforeSemi \.+\*\*\*Not Run diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon-stderr.txt b/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon-stderr.txt new file mode 100644 index 0000000..5101618 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon-stderr.txt @@ -0,0 +1,11 @@ +CMake Warning \(dev\) in CMakeLists\.txt: + Policy CMP0110 is not set: add_test\(\) supports arbitrary characters in test + names\. Run "cmake --help-policy CMP0110" for policy details\. Use the + cmake_policy command to set the policy and suppress this warning\. + + The following name given to add_test\(\) is invalid if CMP0110 is not set or + set to OLD: + + `BeforeSemi;AfterSemi´ + +This warning is for project developers\. Use -Wno-dev to suppress it\. diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon.cmake b/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon.cmake new file mode 100644 index 0000000..c5da394 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon.cmake @@ -0,0 +1,2 @@ +# CMP0110 not set +include(CMP0110-Common-Semicolon.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-Space-ctest-result.txt b/Tests/RunCMake/add_test/CMP0110-WARN-Space-ctest-result.txt new file mode 100644 index 0000000..45a4fb7 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-Space-ctest-result.txt @@ -0,0 +1 @@ +8 diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-Space-ctest-stderr.txt b/Tests/RunCMake/add_test/CMP0110-WARN-Space-ctest-stderr.txt new file mode 100644 index 0000000..2ded1d4 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-Space-ctest-stderr.txt @@ -0,0 +1 @@ +Unable to find executable: AfterSpace diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-Space-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-WARN-Space-ctest-stdout.txt new file mode 100644 index 0000000..059c625 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-Space-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: BeforeSpace \.+\*\*\*Not Run diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-Space-stderr.txt b/Tests/RunCMake/add_test/CMP0110-WARN-Space-stderr.txt new file mode 100644 index 0000000..862eaa2 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-Space-stderr.txt @@ -0,0 +1,11 @@ +CMake Warning \(dev\) in CMakeLists\.txt: + Policy CMP0110 is not set: add_test\(\) supports arbitrary characters in test + names\. Run "cmake --help-policy CMP0110" for policy details\. Use the + cmake_policy command to set the policy and suppress this warning\. + + The following name given to add_test\(\) is invalid if CMP0110 is not set or + set to OLD: + + `BeforeSpace AfterSpace´ + +This warning is for project developers\. Use -Wno-dev to suppress it\. diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-Space.cmake b/Tests/RunCMake/add_test/CMP0110-WARN-Space.cmake new file mode 100644 index 0000000..1f3234c --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-Space.cmake @@ -0,0 +1,2 @@ +# CMP0110 not set +include(CMP0110-Common-Space.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-ValidSpecialChars-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-WARN-ValidSpecialChars-ctest-stdout.txt new file mode 100644 index 0000000..ae1a0b1 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-ValidSpecialChars-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: abc_\.\+-012 \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-ValidSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-WARN-ValidSpecialChars.cmake new file mode 100644 index 0000000..687c899 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-ValidSpecialChars.cmake @@ -0,0 +1,2 @@ +# CMP0110 not set +include(CMP0110-Common-ValidSpecialChars.cmake) diff --git a/Tests/RunCMake/add_test/CMakeLists.txt b/Tests/RunCMake/add_test/CMakeLists.txt new file mode 100644 index 0000000..ee8fc29 --- /dev/null +++ b/Tests/RunCMake/add_test/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.18) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/add_test/RunCMakeTest.cmake b/Tests/RunCMake/add_test/RunCMakeTest.cmake new file mode 100644 index 0000000..bf6cbff --- /dev/null +++ b/Tests/RunCMake/add_test/RunCMakeTest.cmake @@ -0,0 +1,35 @@ +include(RunCMake) + +set(ENV{CTEST_OUTPUT_ON_FAILURE} 1) + +function(run_case CASE_NAME) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CMP0110-${CASE_NAME}-build) + run_cmake(CMP0110-${CASE_NAME}) + # Run ctest on the generated CTestTestfile.cmake. + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(CMP0110-${CASE_NAME}-ctest ${CMAKE_CTEST_COMMAND} -C Debug) +endfunction() + +set(cases + AlphaNumeric + ValidSpecialChars + OtherSpecialChars + EscapedSpecialChars + Space + LeadingAndTrailingWhitespace + Semicolon + Quote + BracketArgument + ) + +if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + list(APPEND cases FormerInvalidSpecialCharsMC) +else() + list(APPEND cases FormerInvalidSpecialChars) +endif() + +foreach(case IN LISTS cases) + run_case(WARN-${case}) + run_case(OLD-${case}) + run_case(NEW-${case}) +endforeach() diff --git a/Tests/RunCMake/target_link_libraries/SharedDepNotTarget.cmake b/Tests/RunCMake/target_link_libraries/SharedDepNotTarget.cmake index bab537e..d6ddfae 100644 --- a/Tests/RunCMake/target_link_libraries/SharedDepNotTarget.cmake +++ b/Tests/RunCMake/target_link_libraries/SharedDepNotTarget.cmake @@ -3,7 +3,8 @@ set(CMAKE_LINK_DEPENDENT_LIBRARY_DIRS 1) set(CMAKE_SHARED_LIBRARY_SUFFIX ".so") add_library(imported SHARED IMPORTED) set_target_properties(imported PROPERTIES - IMPORTED_LOCATION "imported" + IMPORTED_LOCATION "imported${CMAKE_SHARED_LIBRARY_SUFFIX}" + IMPORTED_IMPLIB "imported${CMAKE_IMPORT_LIBRARY_SUFFIX}" IMPORTED_LINK_DEPENDENT_LIBRARIES "/path/to/libSharedDep.so" ) add_executable(empty empty.c) diff --git a/Tests/RunCMake/target_link_libraries/UNKNOWN-IMPORTED-GLOBAL.cmake b/Tests/RunCMake/target_link_libraries/UNKNOWN-IMPORTED-GLOBAL.cmake index f52fa30..608f47b 100644 --- a/Tests/RunCMake/target_link_libraries/UNKNOWN-IMPORTED-GLOBAL.cmake +++ b/Tests/RunCMake/target_link_libraries/UNKNOWN-IMPORTED-GLOBAL.cmake @@ -1,4 +1,5 @@ enable_language(C) add_library(UnknownImportedGlobal UNKNOWN IMPORTED GLOBAL) +set_target_properties(UnknownImportedGlobal PROPERTIES IMPORTED_LOCATION "unknown.${CMAKE_SHARED_LIBRARY_SUFFIX}") add_library(mylib empty.c) target_link_libraries(mylib UnknownImportedGlobal) diff --git a/Tests/UseSWIG/CMakeLists.txt b/Tests/UseSWIG/CMakeLists.txt index 7046fab..aee3338 100644 --- a/Tests/UseSWIG/CMakeLists.txt +++ b/Tests/UseSWIG/CMakeLists.txt @@ -101,6 +101,15 @@ add_test(NAME UseSWIG.MultiplePython COMMAND --build-options ${build_options} --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) +add_test(NAME UseSWIG.MultipleFiles COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/UseSWIG/MultipleFiles" + "${CMake_BINARY_DIR}/Tests/UseSWIG/MultipleFiles" + ${build_generator_args} + --build-project TestMultipleFiles + --build-options ${build_options} + ) add_test(NAME UseSWIG.ModuleVersion2 COMMAND diff --git a/Tests/UseSWIG/MultipleFiles/CMakeLists.txt b/Tests/UseSWIG/MultipleFiles/CMakeLists.txt new file mode 100644 index 0000000..bf3d946 --- /dev/null +++ b/Tests/UseSWIG/MultipleFiles/CMakeLists.txt @@ -0,0 +1,30 @@ +cmake_minimum_required(VERSION 3.18) + +project(TestMultipleFiles CXX) + +find_package(SWIG REQUIRED) +include(UseSWIG) + +unset(SWIG_LANG_TYPE) +unset(SWIG_LANG_INCLUDE_DIRECTORIES) +unset(SWIG_LANG_DEFINITIONS) +unset(SWIG_LANG_OPTIONS) +unset(SWIG_LANG_LIBRARIES) + +find_package(Python3 REQUIRED COMPONENTS Development) + +set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/add.i" PROPERTY CPLUSPLUS ON) +set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/sub.i" PROPERTY CPLUSPLUS ON) +set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/add.i" PROPERTY SWIG_MODULE_NAME _add) +set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/sub.i" PROPERTY SWIG_MODULE_NAME _sub) + + +swig_add_library(example + LANGUAGE python + TYPE MODULE + SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/add.i" + "${CMAKE_CURRENT_SOURCE_DIR}/sub.i" + "${CMAKE_CURRENT_SOURCE_DIR}/add.cxx" + "${CMAKE_CURRENT_SOURCE_DIR}/sub.cxx") +target_include_directories(example PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") +target_link_libraries(example PRIVATE Python3::Module) diff --git a/Tests/UseSWIG/MultipleFiles/add.cxx b/Tests/UseSWIG/MultipleFiles/add.cxx new file mode 100644 index 0000000..a4dcca3 --- /dev/null +++ b/Tests/UseSWIG/MultipleFiles/add.cxx @@ -0,0 +1,6 @@ +#include "add.h" + +int add(int a, int b) +{ + return a + b; +} diff --git a/Tests/UseSWIG/MultipleFiles/add.h b/Tests/UseSWIG/MultipleFiles/add.h new file mode 100644 index 0000000..6295ab9 --- /dev/null +++ b/Tests/UseSWIG/MultipleFiles/add.h @@ -0,0 +1 @@ +int add(int a, int b); diff --git a/Tests/UseSWIG/MultipleFiles/add.i b/Tests/UseSWIG/MultipleFiles/add.i new file mode 100644 index 0000000..2046397 --- /dev/null +++ b/Tests/UseSWIG/MultipleFiles/add.i @@ -0,0 +1,4 @@ +%{ +#include "add.h" +%} +%include "add.h" diff --git a/Tests/UseSWIG/MultipleFiles/sub.cxx b/Tests/UseSWIG/MultipleFiles/sub.cxx new file mode 100644 index 0000000..d6874ef --- /dev/null +++ b/Tests/UseSWIG/MultipleFiles/sub.cxx @@ -0,0 +1,6 @@ +#include "sub.h" + +int sub(int a, int b) +{ + return a - b; +} diff --git a/Tests/UseSWIG/MultipleFiles/sub.h b/Tests/UseSWIG/MultipleFiles/sub.h new file mode 100644 index 0000000..de77111 --- /dev/null +++ b/Tests/UseSWIG/MultipleFiles/sub.h @@ -0,0 +1 @@ +int sub(int a, int b); diff --git a/Tests/UseSWIG/MultipleFiles/sub.i b/Tests/UseSWIG/MultipleFiles/sub.i new file mode 100644 index 0000000..fc70f10 --- /dev/null +++ b/Tests/UseSWIG/MultipleFiles/sub.i @@ -0,0 +1,5 @@ +%{ +#include "sub.h" +%} + +%include "sub.h" |