diff options
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/ModuleDefinition/CMakeLists.txt | 12 | ||||
-rw-r--r-- | Tests/OutOfSource/CMakeLists.txt | 3 | ||||
-rw-r--r-- | Tests/OutOfSource/SubInBuildCMakeLists.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/CMakePresets/Comment-stderr.txt | 9 | ||||
-rw-r--r-- | Tests/RunCMake/CMakePresets/EmptyPresetName-stderr.txt | 5 | ||||
-rw-r--r-- | Tests/RunCMake/CMakePresets/IncludeNotFound-stderr.txt | 5 | ||||
-rw-r--r-- | Tests/RunCMake/CMakePresets/JSONParseError-stderr.txt | 9 | ||||
-rw-r--r-- | Tests/RunCMake/FetchContent/RunCMakeTest.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/FetchContent/VerifyHeaderSet-stdout.txt | 4 | ||||
-rw-r--r-- | Tests/RunCMake/FetchContent/VerifyHeaderSet.cmake | 16 | ||||
-rw-r--r-- | Tests/RunCMake/FetchContent/VerifyHeaderSet/CMakeLists.txt | 9 | ||||
-rw-r--r-- | Tests/RunCMake/FetchContent/VerifyHeaderSet/blah.h | 1 |
12 files changed, 70 insertions, 5 deletions
diff --git a/Tests/ModuleDefinition/CMakeLists.txt b/Tests/ModuleDefinition/CMakeLists.txt index 567fb4b..483bd8b 100644 --- a/Tests/ModuleDefinition/CMakeLists.txt +++ b/Tests/ModuleDefinition/CMakeLists.txt @@ -15,7 +15,17 @@ add_custom_command(OUTPUT example_dll_gen.def add_library(example_dll_gen SHARED example_dll_gen.c example_dll_gen.def) # Test /DEF:<file> flag recognition for VS. -if(MSVC OR CMAKE_C_COMPILER_ID STREQUAL "Intel") +if(MSVC AND CMAKE_C_COMPILER_ID STREQUAL "IntelLLVM") + # IntelLLVM for MSVC frontend variant needs the /DEF flag wrapped to be sent + # to the linker, which happens automatically when the DEF file is added + # to the sources. + add_library(example_dll_2 SHARED + example_dll_2.c + "${ModuleDefinition_SOURCE_DIR}/example_dll_2.def" + ) + set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS EXAMPLE_DLL_2) + set(example_dll_2 example_dll_2) +elseif(MSVC OR CMAKE_C_COMPILER_ID STREQUAL "Intel") add_library(example_dll_2 SHARED example_dll_2.c) set_property(TARGET example_dll_2 PROPERTY LINK_FLAGS /DEF:"${ModuleDefinition_SOURCE_DIR}/example_dll_2.def") diff --git a/Tests/OutOfSource/CMakeLists.txt b/Tests/OutOfSource/CMakeLists.txt index 4687882..c82d077 100644 --- a/Tests/OutOfSource/CMakeLists.txt +++ b/Tests/OutOfSource/CMakeLists.txt @@ -16,3 +16,6 @@ configure_file( ) set(KEN 1) + +configure_file(SubInBuildCMakeLists.cmake ${CMAKE_CURRENT_BINARY_DIR}/SubInBuild/CMakeLists.txt COPYONLY) +add_subdirectory(${CMAKE_CURRENT_BINARY_DIR}/SubInBuild ${CMAKE_CURRENT_BINARY_DIR}/SubInBuild/Build) diff --git a/Tests/OutOfSource/SubInBuildCMakeLists.cmake b/Tests/OutOfSource/SubInBuildCMakeLists.cmake new file mode 100644 index 0000000..c2e2942 --- /dev/null +++ b/Tests/OutOfSource/SubInBuildCMakeLists.cmake @@ -0,0 +1 @@ +add_custom_target(SubInBuildCustom ALL) diff --git a/Tests/RunCMake/CMakePresets/Comment-stderr.txt b/Tests/RunCMake/CMakePresets/Comment-stderr.txt index 2f404bc..b3b6b66 100644 --- a/Tests/RunCMake/CMakePresets/Comment-stderr.txt +++ b/Tests/RunCMake/CMakePresets/Comment-stderr.txt @@ -1,2 +1,9 @@ ^CMake Error: Could not read presets from [^ -]*/Tests/RunCMake/CMakePresets/Comment: JSON parse error$ +]*/Tests/RunCMake/CMakePresets/Comment: JSON parse error +Errors: +[^ +]*Comment\/CMakePresets.json: +\* Line 1, Column 1 + Syntax error: value, object or array expected\. +\* Line 2, Column 1 + Extra non-whitespace after JSON value\.$ diff --git a/Tests/RunCMake/CMakePresets/EmptyPresetName-stderr.txt b/Tests/RunCMake/CMakePresets/EmptyPresetName-stderr.txt index 6970674..0d3c500 100644 --- a/Tests/RunCMake/CMakePresets/EmptyPresetName-stderr.txt +++ b/Tests/RunCMake/CMakePresets/EmptyPresetName-stderr.txt @@ -1,2 +1,5 @@ ^CMake Error: Could not read presets from [^ -]*/Tests/RunCMake/CMakePresets/EmptyPresetName: Invalid preset$ +]*/Tests/RunCMake/CMakePresets/EmptyPresetName: Invalid preset +Errors: +[^ +]*/EmptyPresetName/CMakePresets.json$ diff --git a/Tests/RunCMake/CMakePresets/IncludeNotFound-stderr.txt b/Tests/RunCMake/CMakePresets/IncludeNotFound-stderr.txt index 7ccabab..85a2d78 100644 --- a/Tests/RunCMake/CMakePresets/IncludeNotFound-stderr.txt +++ b/Tests/RunCMake/CMakePresets/IncludeNotFound-stderr.txt @@ -1,2 +1,5 @@ ^CMake Error: Could not read presets from [^ -]*/Tests/RunCMake/CMakePresets/IncludeNotFound: File not found$ +]*/Tests/RunCMake/CMakePresets/IncludeNotFound: File not found +Errors: +[^ +]*/IncludeNotFound/NotFound.json: Failed to read file$ diff --git a/Tests/RunCMake/CMakePresets/JSONParseError-stderr.txt b/Tests/RunCMake/CMakePresets/JSONParseError-stderr.txt index a43bf77..89eff9f 100644 --- a/Tests/RunCMake/CMakePresets/JSONParseError-stderr.txt +++ b/Tests/RunCMake/CMakePresets/JSONParseError-stderr.txt @@ -1,2 +1,9 @@ ^CMake Error: Could not read presets from [^ -]*/Tests/RunCMake/CMakePresets/JSONParseError: JSON parse error$ +]*/Tests/RunCMake/CMakePresets/JSONParseError: JSON parse error +Errors: +[^ +]*JSONParseError/CMakePresets.json: +\* Line 1, Column 1 + Syntax error: value, object or array expected\. +\* Line 1, Column 1 + A valid JSON document must be either an array or an object value\.$ diff --git a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake index e83c45e..a7ccf83 100644 --- a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake +++ b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake @@ -15,6 +15,7 @@ run_cmake(UsesTerminalOverride) run_cmake(MakeAvailable) run_cmake(MakeAvailableTwice) run_cmake(MakeAvailableUndeclared) +run_cmake(VerifyHeaderSet) run_cmake_with_options(ManualSourceDirectory -D "FETCHCONTENT_SOURCE_DIR_WITHPROJECT=${CMAKE_CURRENT_LIST_DIR}/WithProject" diff --git a/Tests/RunCMake/FetchContent/VerifyHeaderSet-stdout.txt b/Tests/RunCMake/FetchContent/VerifyHeaderSet-stdout.txt new file mode 100644 index 0000000..354529d --- /dev/null +++ b/Tests/RunCMake/FetchContent/VerifyHeaderSet-stdout.txt @@ -0,0 +1,4 @@ +-- Before subproject, var = 'TRUE' +-- Inside subproject, var = 'FALSE' +-- After subproject, var = 'TRUE' +-- Subproject target property VERIFY_INTERFACE_HEADER_SETS='FALSE' diff --git a/Tests/RunCMake/FetchContent/VerifyHeaderSet.cmake b/Tests/RunCMake/FetchContent/VerifyHeaderSet.cmake new file mode 100644 index 0000000..8adfcea --- /dev/null +++ b/Tests/RunCMake/FetchContent/VerifyHeaderSet.cmake @@ -0,0 +1,16 @@ +enable_language(C) + +set(CMAKE_VERIFY_INTERFACE_HEADER_SETS TRUE) + +include(FetchContent) +FetchContent_Declare(verify_subproj + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/VerifyHeaderSet +) +message(STATUS "Before subproject, var = '${CMAKE_VERIFY_INTERFACE_HEADER_SETS}'") +FetchContent_MakeAvailable(verify_subproj) + +# Provide a way to verify the variable was reset back to its original value +message(STATUS "After subproject, var = '${CMAKE_VERIFY_INTERFACE_HEADER_SETS}'") + +get_property(verify TARGET Blah PROPERTY VERIFY_INTERFACE_HEADER_SETS) +message(STATUS "Subproject target property VERIFY_INTERFACE_HEADER_SETS='${verify}'") diff --git a/Tests/RunCMake/FetchContent/VerifyHeaderSet/CMakeLists.txt b/Tests/RunCMake/FetchContent/VerifyHeaderSet/CMakeLists.txt new file mode 100644 index 0000000..c6ba37e --- /dev/null +++ b/Tests/RunCMake/FetchContent/VerifyHeaderSet/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.24) +project(VerifyHeaderSet LANGUAGES C) + +message(STATUS "Inside subproject, var = '${CMAKE_VERIFY_INTERFACE_HEADER_SETS}'") + +add_library(Blah INTERFACE) +target_sources(Blah + INTERFACE FILE_SET HEADERS FILES blah.h +) diff --git a/Tests/RunCMake/FetchContent/VerifyHeaderSet/blah.h b/Tests/RunCMake/FetchContent/VerifyHeaderSet/blah.h new file mode 100644 index 0000000..5b47e14 --- /dev/null +++ b/Tests/RunCMake/FetchContent/VerifyHeaderSet/blah.h @@ -0,0 +1 @@ +#error Header was used |