diff options
author | Stephen Kelly <steveire@gmail.com> | 2014-11-28 17:58:38 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-02-10 23:51:34 (GMT) |
commit | 6da65b3907419df28484c570f24d0da3593a0e5a (patch) | |
tree | ae814193dd7306ad6aa369dca4d489f9f8f6eaf9 /Tests/RunCMake | |
parent | 736bcb9664b714b91e8a2a573451e0453716f4da (diff) | |
download | CMake-6da65b3907419df28484c570f24d0da3593a0e5a.zip CMake-6da65b3907419df28484c570f24d0da3593a0e5a.tar.gz CMake-6da65b3907419df28484c570f24d0da3593a0e5a.tar.bz2 |
Allow export of targets with INTERFACE_SOURCES.
Use the same rules for paths in source and binary dirs in
installed INTERFACE_SOURCES as are used for
INTERFACE_INCLUDE_DIRECTORIES.
Diffstat (limited to 'Tests/RunCMake')
22 files changed, 91 insertions, 16 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 71507b8..2de82a7 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -192,6 +192,9 @@ add_RunCMake_test(ExternalProject) set(IfacePaths_INCLUDE_DIRECTORIES_ARGS -DTEST_PROP=INCLUDE_DIRECTORIES) add_RunCMake_test(IfacePaths_INCLUDE_DIRECTORIES TEST_DIR IfacePaths) +set(IfacePaths_SOURCES_ARGS -DTEST_PROP=SOURCES) +add_RunCMake_test(IfacePaths_SOURCES TEST_DIR IfacePaths) + if(RPMBUILD) add_RunCMake_test(CPackRPM) endif() diff --git a/Tests/RunCMake/TargetSources/ExportInstall-result.txt b/Tests/RunCMake/IfacePaths/BinInInstallPrefix-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/TargetSources/ExportInstall-result.txt +++ b/Tests/RunCMake/IfacePaths/BinInInstallPrefix-result.txt diff --git a/Tests/RunCMake/IfacePaths/BinInInstallPrefix-stderr_SOURCES.txt b/Tests/RunCMake/IfacePaths/BinInInstallPrefix-stderr_SOURCES.txt new file mode 100644 index 0000000..239c069 --- /dev/null +++ b/Tests/RunCMake/IfacePaths/BinInInstallPrefix-stderr_SOURCES.txt @@ -0,0 +1,6 @@ +CMake Error in CMakeLists.txt: + Target "testTarget" INTERFACE_SOURCES property contains path: + + ".*Tests/RunCMake/IfacePaths_SOURCES/prefix/BinInInstallPrefix-build/empty.cpp" + + which is prefixed in the build directory. diff --git a/Tests/RunCMake/IfacePaths/BinaryDirectoryInInterface-stderr_SOURCES.txt b/Tests/RunCMake/IfacePaths/BinaryDirectoryInInterface-stderr_SOURCES.txt new file mode 100644 index 0000000..e931a01 --- /dev/null +++ b/Tests/RunCMake/IfacePaths/BinaryDirectoryInInterface-stderr_SOURCES.txt @@ -0,0 +1,6 @@ +CMake Error in CMakeLists.txt: + Target "testTarget" INTERFACE_SOURCES property contains path: + + ".*Tests/RunCMake/IfacePaths_SOURCES/BinaryDirectoryInInterface-build/empty.cpp" + + which is prefixed in the build directory. diff --git a/Tests/RunCMake/IfacePaths/BinaryDirectoryInInterface.cmake b/Tests/RunCMake/IfacePaths/BinaryDirectoryInInterface.cmake index 67ee7de..7001f3f 100644 --- a/Tests/RunCMake/IfacePaths/BinaryDirectoryInInterface.cmake +++ b/Tests/RunCMake/IfacePaths/BinaryDirectoryInInterface.cmake @@ -2,7 +2,11 @@ enable_language(CXX) add_library(testTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp") -target_include_directories(testTarget INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/foo") +if (TEST_PROP STREQUAL INCLUDE_DIRECTORIES) + set_property(TARGET testTarget PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/foo") +else() + set_property(TARGET testTarget PROPERTY INTERFACE_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/empty.cpp") +endif() install(TARGETS testTarget EXPORT testTargets DESTINATION lib diff --git a/Tests/RunCMake/IfacePaths/DirInInstallPrefix.cmake b/Tests/RunCMake/IfacePaths/DirInInstallPrefix.cmake index fab7717..f5f3005 100644 --- a/Tests/RunCMake/IfacePaths/DirInInstallPrefix.cmake +++ b/Tests/RunCMake/IfacePaths/DirInInstallPrefix.cmake @@ -1,6 +1,11 @@ enable_language(CXX) add_library(testTarget empty.cpp) -target_include_directories(testTarget INTERFACE "${CMAKE_INSTALL_PREFIX}/dir") + +if (TEST_PROP STREQUAL INCLUDE_DIRECTORIES) + set_property(TARGET testTarget PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/dir") +else() + set_property(TARGET testTarget PROPERTY INTERFACE_SOURCES "${CMAKE_INSTALL_PREFIX}/empty.cpp") +endif() install(TARGETS testTarget EXPORT testTargets DESTINATION lib diff --git a/Tests/RunCMake/IfacePaths/InstallInBinDir-stderr_SOURCES.txt b/Tests/RunCMake/IfacePaths/InstallInBinDir-stderr_SOURCES.txt new file mode 100644 index 0000000..c79d598 --- /dev/null +++ b/Tests/RunCMake/IfacePaths/InstallInBinDir-stderr_SOURCES.txt @@ -0,0 +1,6 @@ +CMake Error in CMakeLists.txt: + Target "testTarget" INTERFACE_SOURCES property contains path: + + ".*Tests/RunCMake/IfacePaths_SOURCES/InstallInBinDir-build/empty.cpp" + + which is prefixed in the build directory. diff --git a/Tests/RunCMake/IfacePaths/InstallInSrcDir-stderr_SOURCES.txt b/Tests/RunCMake/IfacePaths/InstallInSrcDir-stderr_SOURCES.txt new file mode 100644 index 0000000..e71921e --- /dev/null +++ b/Tests/RunCMake/IfacePaths/InstallInSrcDir-stderr_SOURCES.txt @@ -0,0 +1,6 @@ +CMake Error in CMakeLists.txt: + Target "testTarget" INTERFACE_SOURCES property contains path: + + ".*Tests/RunCMake/IfacePaths_SOURCES/copy/empty.cpp" + + which is prefixed in the source directory. diff --git a/Tests/RunCMake/IfacePaths/RelativePathInGenex-stderr_SOURCES.txt b/Tests/RunCMake/IfacePaths/RelativePathInGenex-stderr_SOURCES.txt new file mode 100644 index 0000000..2311af9 --- /dev/null +++ b/Tests/RunCMake/IfacePaths/RelativePathInGenex-stderr_SOURCES.txt @@ -0,0 +1,4 @@ +CMake Error in CMakeLists.txt: + Target "testTarget" contains relative path in its INTERFACE_SOURCES: + + "empty.cpp" diff --git a/Tests/RunCMake/IfacePaths/RelativePathInGenex.cmake b/Tests/RunCMake/IfacePaths/RelativePathInGenex.cmake index 070a381..489c3a1 100644 --- a/Tests/RunCMake/IfacePaths/RelativePathInGenex.cmake +++ b/Tests/RunCMake/IfacePaths/RelativePathInGenex.cmake @@ -2,7 +2,12 @@ enable_language(CXX) add_library(testTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp") -set_property(TARGET testTarget PROPERTY INTERFACE_INCLUDE_DIRECTORIES "$<1:foo>") + +if (TEST_PROP STREQUAL INCLUDE_DIRECTORIES) + set_property(TARGET testTarget PROPERTY INTERFACE_INCLUDE_DIRECTORIES "$<1:foo>") +else() + set_property(TARGET testTarget PROPERTY INTERFACE_SOURCES "$<1:empty.cpp>") +endif() add_library(userTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp") target_link_libraries(userTarget testTarget) diff --git a/Tests/RunCMake/IfacePaths/RelativePathInInterface-stderr_SOURCES.txt b/Tests/RunCMake/IfacePaths/RelativePathInInterface-stderr_SOURCES.txt new file mode 100644 index 0000000..f0f002c --- /dev/null +++ b/Tests/RunCMake/IfacePaths/RelativePathInInterface-stderr_SOURCES.txt @@ -0,0 +1,4 @@ +CMake Error in CMakeLists.txt: + Target "testTarget" INTERFACE_SOURCES property contains relative path: + + "empty.cpp" diff --git a/Tests/RunCMake/IfacePaths/RelativePathInInterface.cmake b/Tests/RunCMake/IfacePaths/RelativePathInInterface.cmake index 4c4727d..e974aac 100644 --- a/Tests/RunCMake/IfacePaths/RelativePathInInterface.cmake +++ b/Tests/RunCMake/IfacePaths/RelativePathInInterface.cmake @@ -2,8 +2,11 @@ enable_language(CXX) add_library(testTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp") -set_property(TARGET testTarget PROPERTY INTERFACE_INCLUDE_DIRECTORIES "foo") - +if (TEST_PROP STREQUAL INCLUDE_DIRECTORIES) + set_property(TARGET testTarget PROPERTY INTERFACE_INCLUDE_DIRECTORIES "foo") +else() + set_property(TARGET testTarget PROPERTY INTERFACE_SOURCES "empty.cpp") +endif() install(TARGETS testTarget EXPORT testTargets DESTINATION lib ) diff --git a/Tests/RunCMake/IfacePaths/SourceDirectoryInInterface-stderr_SOURCES.txt b/Tests/RunCMake/IfacePaths/SourceDirectoryInInterface-stderr_SOURCES.txt new file mode 100644 index 0000000..c5157ad --- /dev/null +++ b/Tests/RunCMake/IfacePaths/SourceDirectoryInInterface-stderr_SOURCES.txt @@ -0,0 +1,6 @@ +CMake Error in CMakeLists.txt: + Target "testTarget" INTERFACE_SOURCES property contains path: + + ".*Tests/RunCMake/IfacePaths/empty.cpp" + + which is prefixed in the source directory. diff --git a/Tests/RunCMake/IfacePaths/SourceDirectoryInInterface.cmake b/Tests/RunCMake/IfacePaths/SourceDirectoryInInterface.cmake index f814a3c..d80cbec 100644 --- a/Tests/RunCMake/IfacePaths/SourceDirectoryInInterface.cmake +++ b/Tests/RunCMake/IfacePaths/SourceDirectoryInInterface.cmake @@ -2,7 +2,11 @@ enable_language(CXX) add_library(testTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp") -target_include_directories(testTarget INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/foo") +if (TEST_PROP STREQUAL INCLUDE_DIRECTORIES) + set_property(TARGET testTarget PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/foo") +else() + set_property(TARGET testTarget PROPERTY INTERFACE_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp") +endif() install(TARGETS testTarget EXPORT testTargets DESTINATION lib diff --git a/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-result.txt b/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-stderr_SOURCES.txt b/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-stderr_SOURCES.txt new file mode 100644 index 0000000..48f2485 --- /dev/null +++ b/Tests/RunCMake/IfacePaths/SrcInInstallPrefix-stderr_SOURCES.txt @@ -0,0 +1,6 @@ +CMake Error in CMakeLists.txt: + Target "testTarget" INTERFACE_SOURCES property contains path: + + ".*Tests/RunCMake/IfacePaths_SOURCES/prefix/src/empty.cpp" + + which is prefixed in the source directory. diff --git a/Tests/RunCMake/IfacePaths/export-NOWARN.cmake b/Tests/RunCMake/IfacePaths/export-NOWARN.cmake index 50720a0..592572c 100644 --- a/Tests/RunCMake/IfacePaths/export-NOWARN.cmake +++ b/Tests/RunCMake/IfacePaths/export-NOWARN.cmake @@ -1,19 +1,34 @@ enable_language(CXX) add_library(foo empty.cpp) + set_property(TARGET foo APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $<0:>/include/subdir) set_property(TARGET foo APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $<INSTALL_PREFIX>/include/subdir) +set_property(TARGET foo APPEND PROPERTY INTERFACE_SOURCES $<0:>/include/subdir/empty.cpp) +set_property(TARGET foo APPEND PROPERTY INTERFACE_SOURCES $<INSTALL_PREFIX>/include/subdir/empty.cpp) set_property(TARGET foo APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include/subdir>) set_property(TARGET foo APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $<INSTALL_INTERFACE:include/subdir>) set_property(TARGET foo APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $<INSTALL_INTERFACE:include/$<0:>>) set_property(TARGET foo APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $<INSTALL_INTERFACE:$<0:>/include>) +set_property(TARGET foo APPEND PROPERTY INTERFACE_SOURCES $<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include/subdir/empty.cpp>) +set_property(TARGET foo APPEND PROPERTY INTERFACE_SOURCES $<INSTALL_INTERFACE:include/subdir/empty.cpp>) +set_property(TARGET foo APPEND PROPERTY INTERFACE_SOURCES $<INSTALL_INTERFACE:include/subdir/empty.cpp$<0:>>) +set_property(TARGET foo APPEND PROPERTY INTERFACE_SOURCES $<INSTALL_INTERFACE:$<0:>/include/subdir/empty.cpp>) # target_include_directories(foo INTERFACE include/subdir) # Does and should warn. INSTALL_INTERFACE must not list src dir paths. target_include_directories(foo INTERFACE $<0:>/include/subdir) # Does not and should not should warn, because it starts with a genex. target_include_directories(foo INTERFACE $<INSTALL_PREFIX>/include/subdir) +target_sources(foo INTERFACE $<0:>/include/subdir/empty.cpp) +target_sources(foo INTERFACE $<INSTALL_PREFIX>/include/subdir/empty.cpp) target_include_directories(foo INTERFACE $<INSTALL_INTERFACE:include/subdir>) target_include_directories(foo INTERFACE $<INSTALL_INTERFACE:include/$<0:>>) +target_sources(foo INTERFACE $<INSTALL_INTERFACE:include/subdir/empty.cpp>) +target_sources(foo INTERFACE $<INSTALL_INTERFACE:include/subdir/empty.cpp$<0:>>) + +install(FILES include/subdir/empty.cpp + DESTINATION include/subdir +) install(TARGETS foo EXPORT FooTargets DESTINATION lib) install(EXPORT FooTargets DESTINATION lib/cmake) diff --git a/Tests/RunCMake/TargetSources/ExportBuild-result.txt b/Tests/RunCMake/TargetSources/ExportBuild-result.txt index d00491f..573541a 100644 --- a/Tests/RunCMake/TargetSources/ExportBuild-result.txt +++ b/Tests/RunCMake/TargetSources/ExportBuild-result.txt @@ -1 +1 @@ -1 +0 diff --git a/Tests/RunCMake/TargetSources/ExportBuild-stderr.txt b/Tests/RunCMake/TargetSources/ExportBuild-stderr.txt deleted file mode 100644 index 0d65a55..0000000 --- a/Tests/RunCMake/TargetSources/ExportBuild-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -CMake Error: Target "iface" has a populated INTERFACE_SOURCES property. This is not currently supported. diff --git a/Tests/RunCMake/TargetSources/ExportInstall-stderr.txt b/Tests/RunCMake/TargetSources/ExportInstall-stderr.txt deleted file mode 100644 index 0d65a55..0000000 --- a/Tests/RunCMake/TargetSources/ExportInstall-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -CMake Error: Target "iface" has a populated INTERFACE_SOURCES property. This is not currently supported. diff --git a/Tests/RunCMake/TargetSources/ExportInstall.cmake b/Tests/RunCMake/TargetSources/ExportInstall.cmake deleted file mode 100644 index 8e7c9f9..0000000 --- a/Tests/RunCMake/TargetSources/ExportInstall.cmake +++ /dev/null @@ -1,6 +0,0 @@ - -add_library(iface INTERFACE) -target_sources(iface INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/empty_1.cpp") - -install(TARGETS iface EXPORT exp) -install(EXPORT exp DESTINATION cmake) diff --git a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake index 1b4ef0b..4416ef9 100644 --- a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake +++ b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake @@ -10,4 +10,3 @@ endif() run_cmake(CMP0026-LOCATION) run_cmake(RelativePathInInterface) run_cmake(ExportBuild) -run_cmake(ExportInstall) |