summaryrefslogtreecommitdiff
path: root/Tests/ExportImport/Import/A/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/ExportImport/Import/A/CMakeLists.txt')
-rw-r--r--Tests/ExportImport/Import/A/CMakeLists.txt51
1 files changed, 49 insertions, 2 deletions
diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt
index 884179225..0337130f4 100644
--- a/Tests/ExportImport/Import/A/CMakeLists.txt
+++ b/Tests/ExportImport/Import/A/CMakeLists.txt
@@ -5,8 +5,8 @@ include(${Import_BINARY_DIR}/../Export/ExportBuildTree.cmake)
include(${CMAKE_INSTALL_PREFIX}/lib/exp/exp.cmake)
# Import two exports, where the Depends one depends on an exported target from the Required one:
-include(${CMAKE_INSTALL_PREFIX}/lib/cmake/testLibRequired/testLibRequiredConfig.cmake)
-include(${CMAKE_INSTALL_PREFIX}/lib/cmake/testLibDepends/testLibDependsConfig.cmake)
+include(${CMAKE_INSTALL_PREFIX}/lib/cmake/testLibRequired/testLibRequiredTargets.cmake)
+include(${CMAKE_INSTALL_PREFIX}/lib/cmake/testLibDepends/testLibDependsTargets.cmake)
# Try referencing an executable imported from the install tree.
add_custom_command(
@@ -152,3 +152,50 @@ check_function_exists(testLib1 HAVE_TESTLIB1_FUNCTION)
if (NOT HAVE_TESTLIB1_FUNCTION)
message(SEND_ERROR "Using imported target testLib2 in check_function_exists() failed !")
endif()
+
+#-----------------------------------------------------------------------------
+# Test that dependent imported targets have usable
+# INTERFACE_COMPILE_DEFINITIONS and INTERFACE_INCLUDE_DIRECTORIES
+
+add_executable(deps_iface deps_iface.c)
+target_link_libraries(deps_iface testLibDepends)
+
+add_executable(deps_shared_iface deps_shared_iface.cpp)
+target_link_libraries(deps_shared_iface testSharedLibDepends)
+target_compile_definitions(deps_shared_iface
+ PRIVATE
+ $<$<BOOL:$<TARGET_PROPERTY:POSITION_INDEPENDENT_CODE>>:PIC_PROPERTY_IS_ON>
+ $<$<BOOL:$<TARGET_PROPERTY:CUSTOM_PROP>>:CUSTOM_PROPERTY_IS_ON>
+ $<$<STREQUAL:$<TARGET_PROPERTY:CUSTOM_STRING>,testcontent>:CUSTOM_STRING_IS_MATCH>
+)
+
+if (APPLE OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
+ include(CheckCXXCompilerFlag)
+ check_cxx_compiler_flag(-fPIE run_pic_test)
+else()
+ if (CMAKE_CXX_COMPILER_ID MATCHES "PGI"
+ OR CMAKE_CXX_COMPILER_ID MATCHES "PathScale"
+ OR CMAKE_SYSTEM_NAME MATCHES "IRIX64"
+ OR CMAKE_CXX_COMPILER_ID MATCHES "Intel")
+ set(run_pic_test 0)
+ else()
+ set(run_pic_test 1)
+ endif()
+endif()
+
+if (run_pic_test)
+ target_compile_definitions(deps_shared_iface PRIVATE CHECK_PIC_WORKS)
+endif()
+
+#-----------------------------------------------------------------------------
+# Test that targets imported from the build tree have their dependencies
+# evaluated correctly. The above already tests the same for the install tree.
+
+add_executable(deps_shared_iface2 deps_shared_iface.cpp)
+target_link_libraries(deps_shared_iface2 bld_testSharedLibDepends bld_subdirlib)
+target_compile_definitions(deps_shared_iface2
+ PRIVATE TEST_SUBDIR_LIB
+ $<$<BOOL:$<TARGET_PROPERTY:POSITION_INDEPENDENT_CODE>>:PIC_PROPERTY_IS_ON>
+ $<$<BOOL:$<TARGET_PROPERTY:CUSTOM_PROP>>:CUSTOM_PROPERTY_IS_ON>
+ $<$<STREQUAL:$<TARGET_PROPERTY:CUSTOM_STRING>,testcontent>:CUSTOM_STRING_IS_MATCH>
+)