|
|
@@ -75,24 +75,64 @@ foreach(c DEBUG RELWITHDEBINFO)
|
|
|
set_property(TARGET imp_testExe1b PROPERTY COMPILE_DEFINITIONS_${c} EXE_DBG)
|
|
|
endforeach(c)
|
|
|
|
|
|
+#-----------------------------------------------------------------------------
|
|
|
# Create a custom target to generate a header for the libraries below.
|
|
|
-include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
|
|
+# Drive the header generation through an indirect chain of imported
|
|
|
+# target dependencies.
|
|
|
+
|
|
|
+# testLib2tmp1.h
|
|
|
add_custom_command(
|
|
|
- OUTPUT testLib2.h
|
|
|
+ OUTPUT testLib2tmp1.h
|
|
|
VERBATIM COMMAND
|
|
|
- ${CMAKE_COMMAND} -E echo "extern int testLib2(void);" > testLib2.h
|
|
|
+ ${CMAKE_COMMAND} -E echo "extern int testLib2(void);" > testLib2tmp1.h
|
|
|
+ )
|
|
|
+
|
|
|
+# hdr_testLib2tmp1 needs testLib2tmp1.h
|
|
|
+add_custom_target(hdr_testLib2tmp1 DEPENDS testLib2tmp1.h)
|
|
|
+
|
|
|
+# exp_testExe2 needs hdr_testLib2tmp1
|
|
|
+add_dependencies(exp_testExe2 hdr_testLib2tmp1)
|
|
|
+
|
|
|
+# testLib2tmp.h needs exp_testExe2
|
|
|
+add_custom_command(
|
|
|
+ OUTPUT testLib2tmp.h
|
|
|
+ VERBATIM COMMAND exp_testExe2
|
|
|
+ COMMAND ${CMAKE_COMMAND} -E copy testLib2tmp1.h testLib2tmp.h
|
|
|
)
|
|
|
+
|
|
|
+# hdr_testLib2tmp needs testLib2tmp.h
|
|
|
+add_custom_target(hdr_testLib2tmp DEPENDS testLib2tmp.h)
|
|
|
+
|
|
|
+add_library(dep_testLib2tmp UNKNOWN IMPORTED)
|
|
|
+set_property(TARGET dep_testLib2tmp PROPERTY
|
|
|
+ IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/testLib2tmp.h)
|
|
|
+
|
|
|
+# dep_testLib2tmp needs hdr_testLib2tmp
|
|
|
+add_dependencies(dep_testLib2tmp hdr_testLib2tmp)
|
|
|
+
|
|
|
+# testLib2.h needs dep_testLib2tmp
|
|
|
+add_custom_command(
|
|
|
+ OUTPUT testLib2.h
|
|
|
+ VERBATIM COMMAND ${CMAKE_COMMAND} -E copy testLib2tmp.h testLib2.h
|
|
|
+ DEPENDS dep_testLib2tmp
|
|
|
+ )
|
|
|
+
|
|
|
+# hdr_testLib2 needs testLib2.h
|
|
|
add_custom_target(hdr_testLib2 DEPENDS testLib2.h)
|
|
|
|
|
|
-# Drive the header generation through an indirect chain of imported
|
|
|
-# target dependencies.
|
|
|
add_library(dep_testLib2 UNKNOWN IMPORTED)
|
|
|
+
|
|
|
+# dep_testLib2 needs hdr_testLib2
|
|
|
add_dependencies(dep_testLib2 hdr_testLib2)
|
|
|
+
|
|
|
+# exp_testLib2 and bld_testLib2 both need dep_testLib2
|
|
|
add_dependencies(bld_testLib2 dep_testLib2)
|
|
|
add_dependencies(exp_testLib2 dep_testLib2)
|
|
|
|
|
|
+#-----------------------------------------------------------------------------
|
|
|
# Create a library to be linked by another directory in this project
|
|
|
# to test transitive linking to otherwise invisible imported targets.
|
|
|
+include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
|
|
add_library(imp_lib1 STATIC imp_lib1.c)
|
|
|
target_link_libraries(imp_lib1 exp_testLib2)
|
|
|
add_library(imp_lib1b STATIC imp_lib1.c)
|