Tests: Prepare RunCMake.GenEx-TARGET_PROPERTY for more independent cases

The existing cases all need to enable a language.  Move this out of the
`CMakeLists.txt` file and into the individual cases to make room for
other cases that may not need this.
This commit is contained in:
Brad King
2022-11-15 10:34:00 -05:00
parent e855ed7fde
commit a4d0e4ff8f
10 changed files with 37 additions and 13 deletions

View File

@@ -1,3 +1,4 @@
enable_language(CXX)
add_subdirectory(BadInvalidName1)
add_subdirectory(BadInvalidName2)
add_subdirectory(BadInvalidName3)
@@ -6,3 +7,6 @@ add_subdirectory(BadInvalidName5)
add_subdirectory(BadInvalidName6)
add_subdirectory(BadInvalidName7)
add_subdirectory(BadInvalidName8)
# Suppress generator-specific targets that might pollute the stderr.
set(CMAKE_SUPPRESS_REGENERATION TRUE)

View File

@@ -1,6 +1,9 @@
enable_language(CXX)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp"
"int main(int, char **) { return 0; }\n")
add_executable(main "${CMAKE_CURRENT_BINARY_DIR}/main.cpp")
include_directories("$<TARGET_PROPERTY:NonExistent,INCLUDE_DIRECTORIES>")
# Suppress generator-specific targets that might pollute the stderr.
set(CMAKE_SUPPRESS_REGENERATION TRUE)

View File

@@ -1,6 +1,10 @@
enable_language(CXX)
add_subdirectory(BadSelfReference1)
add_subdirectory(BadSelfReference2)
add_subdirectory(BadSelfReference3)
add_subdirectory(BadSelfReference4)
add_subdirectory(BadSelfReference5)
add_subdirectory(BadSelfReference6)
# Suppress generator-specific targets that might pollute the stderr.
set(CMAKE_SUPPRESS_REGENERATION TRUE)

View File

@@ -1,8 +1,3 @@
cmake_minimum_required(VERSION 3.3)
project(${RunCMake_TEST} CXX)
# MSVC creates extra targets which pollute the stderr unless we set this.
set(CMAKE_SUPPRESS_REGENERATION TRUE)
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)

View File

@@ -1,4 +1,4 @@
enable_language(CXX)
add_library(empty1 empty.cpp)
add_library(empty2 empty.cpp)
@@ -6,3 +6,6 @@ target_link_libraries(empty1
LINK_PUBLIC
$<$<STREQUAL:$<TARGET_PROPERTY:INCLUDE_DIRECTORIES>,/foo/bar>:empty2>
)
# Suppress generator-specific targets that might pollute the stderr.
set(CMAKE_SUPPRESS_REGENERATION TRUE)

View File

@@ -1,4 +1,4 @@
enable_language(CXX)
add_library(empty1 empty.cpp)
add_library(empty2 empty.cpp)
@@ -6,3 +6,6 @@ target_link_libraries(empty1
LINK_PUBLIC
$<$<STREQUAL:$<TARGET_PROPERTY:INTERFACE_INCLUDE_DIRECTORIES>,/foo/bar>:empty2>
)
# Suppress generator-specific targets that might pollute the stderr.
set(CMAKE_SUPPRESS_REGENERATION TRUE)

View File

@@ -1,4 +1,4 @@
enable_language(CXX)
add_library(empty1 empty.cpp)
add_library(empty2 empty.cpp)
@@ -8,3 +8,6 @@ target_link_libraries(empty1
INTERFACE
$<$<STREQUAL:$<TARGET_PROPERTY:INCLUDE_DIRECTORIES>,/foo/bar>:empty2>
)
# Suppress generator-specific targets that might pollute the stderr.
set(CMAKE_SUPPRESS_REGENERATION TRUE)

View File

@@ -1,4 +1,4 @@
enable_language(CXX)
add_library(empty1 empty.cpp)
add_library(empty2 empty.cpp)
@@ -12,3 +12,6 @@ target_link_libraries(empty1
add_library(empty3 empty.cpp)
target_link_libraries(empty3 empty1)
# Suppress generator-specific targets that might pollute the stderr.
set(CMAKE_SUPPRESS_REGENERATION TRUE)

View File

@@ -1,4 +1,4 @@
enable_language(CXX)
add_library(empty1 INTERFACE IMPORTED)
add_library(empty2 INTERFACE IMPORTED)
@@ -8,3 +8,6 @@ set_property(TARGET empty1 PROPERTY INTERFACE_LINK_LIBRARIES
add_library(empty3 empty.cpp)
target_link_libraries(empty3 empty1)
# Suppress generator-specific targets that might pollute the stderr.
set(CMAKE_SUPPRESS_REGENERATION TRUE)

View File

@@ -1,4 +1,4 @@
enable_language(CXX)
add_library(empty1 SHARED empty.cpp)
add_library(empty2 SHARED empty.cpp)
@@ -12,3 +12,6 @@ target_link_libraries(empty1
add_library(empty3 SHARED empty.cpp)
target_link_libraries(empty3 empty1)
# Suppress generator-specific targets that might pollute the stderr.
set(CMAKE_SUPPRESS_REGENERATION TRUE)