[cmake-commits] king committed CMakeLists.txt 1.1 1.2 TwoSrc.c 1.1 1.2
cmake-commits at cmake.org
cmake-commits at cmake.org
Wed Apr 4 14:49:37 EDT 2007
Update of /cvsroot/CMake/CMake/Tests/Dependency/Two
In directory public:/mounts/ram/cvs-serv1384/Tests/Dependency/Two
Modified Files:
CMakeLists.txt TwoSrc.c
Log Message:
BUG: Fix utility dependencies for static libraries in VS generators. This addresses bug#4789.
Index: TwoSrc.c
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/Dependency/Two/TwoSrc.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- TwoSrc.c 1 May 2002 18:00:21 -0000 1.1
+++ TwoSrc.c 4 Apr 2007 18:49:35 -0000 1.2
@@ -1,4 +1,4 @@
-void ThreeFunction();
+#include <two-test.h>
void TwoFunction()
{
Index: CMakeLists.txt
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/Dependency/Two/CMakeLists.txt,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- CMakeLists.txt 1 May 2002 18:00:21 -0000 1.1
+++ CMakeLists.txt 4 Apr 2007 18:49:35 -0000 1.2
@@ -1,3 +1,20 @@
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
ADD_LIBRARY( Two TwoSrc.c )
TARGET_LINK_LIBRARIES( Two Three )
+# Setup a target to cause failure if Two does not depend on it or if
+# Two actually links to it. This will test that a utility dependency
+# on a library target works properly.
+ADD_CUSTOM_COMMAND(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/two-test.h
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ ${CMAKE_CURRENT_SOURCE_DIR}/two-test.h.in
+ ${CMAKE_CURRENT_BINARY_DIR}/two-test.h
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/two-test.h.in
+ )
+ADD_LIBRARY( TwoCustom TwoCustomSrc.c ${CMAKE_CURRENT_BINARY_DIR}/two-test.h)
+SET_TARGET_PROPERTIES(TwoCustom PROPERTIES EXCLUDE_FROM_ALL 1)
+TARGET_LINK_LIBRARIES(TwoCustom Three)
+
+# Add a utility dependency to make sure it works without linking.
+ADD_DEPENDENCIES(Two TwoCustom)
More information about the Cmake-commits
mailing list