[cmake-commits] hoffman committed A.cxx 1.1 1.1.10.2 CMakeLists.txt
1.49.2.3 1.49.2.5 complex.cxx 1.84.2.3 1.84.2.5
cmake-commits at cmake.org
cmake-commits at cmake.org
Fri Oct 13 10:52:12 EDT 2006
Update of /cvsroot/CMake/CMake/Tests/ComplexOneConfig/Executable
In directory public:/mounts/ram/cvs-serv31017/Tests/ComplexOneConfig/Executable
Modified Files:
Tag: CMake-2-4
A.cxx CMakeLists.txt complex.cxx
Log Message:
ENH: merge changes from the main tree to the 2.4 branch
Index: A.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/ComplexOneConfig/Executable/A.cxx,v
retrieving revision 1.1
retrieving revision 1.1.10.2
diff -u -d -r1.1 -r1.1.10.2
--- A.cxx 22 Oct 2004 21:05:25 -0000 1.1
+++ A.cxx 13 Oct 2006 14:52:08 -0000 1.1.10.2
@@ -1,4 +1,7 @@
+// Include code from a header that should not be compiled separately.
+#include "A.hh"
+
int main()
{
- return 10;
+ return A();
}
Index: CMakeLists.txt
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/ComplexOneConfig/Executable/CMakeLists.txt,v
retrieving revision 1.49.2.3
retrieving revision 1.49.2.5
diff -u -d -r1.49.2.3 -r1.49.2.5
--- CMakeLists.txt 30 Jun 2006 17:48:48 -0000 1.49.2.3
+++ CMakeLists.txt 13 Oct 2006 14:52:08 -0000 1.49.2.5
@@ -19,7 +19,7 @@
SET(COMPLEX_LIBS CMakeTestLibrary;CMakeTestLibraryShared;CMakeTestCLibraryShared)
LINK_LIBRARIES(${COMPLEX_LIBS})
-ADD_EXECUTABLE(A A.cxx)
+ADD_EXECUTABLE(A A.cxx A.hh A.h A.txt)
ADD_EXECUTABLE(complex complex testcflags.c )
# Sub1/NameConflictTest.c Sub2/NameConflictTest.c)
ADD_EXECUTABLE(complex.file complex.file.cxx)
@@ -37,6 +37,12 @@
ENDIF(NOT BORLAND)
ENDIF (UNIX)
+# Test linking to static lib when a shared lib has the same name.
+IF(CMAKE_EXE_LINK_STATIC_CXX_FLAGS)
+ ADD_DEFINITIONS(-DCOMPLEX_TEST_LINK_STATIC)
+ TARGET_LINK_LIBRARIES(complex CMakeTestLinkStatic)
+ENDIF(CMAKE_EXE_LINK_STATIC_CXX_FLAGS)
+
# can we get the path to a source file
GET_SOURCE_FILE_PROPERTY(A_LOCATION A.cxx LOCATION)
IF ("${A_LOCATION}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}/A.cxx")
@@ -95,6 +101,14 @@
DEPENDS ${CMAKE_COMMAND}
)
+# Test creating an executable that is not built by default.
+ADD_EXECUTABLE(notInAllExe EXCLUDE_FROM_ALL notInAllExe.cxx)
+TARGET_LINK_LIBRARIES(notInAllExe notInAllLib)
+
+# Test creating a custom target that builds not-in-all targets.
+ADD_CUSTOM_TARGET(notInAllCustom)
+ADD_DEPENDENCIES(notInAllCustom notInAllExe)
+
#
# Output the files required by 'complex' to a file.
#
@@ -104,6 +118,11 @@
#
ADD_SUBDIRECTORY(Temp)
+IF(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_INCLUDE_SYSTEM_FLAG_CXX)
+ ADD_EXECUTABLE(testSystemDir testSystemDir.cxx)
+ SET_TARGET_PROPERTIES(testSystemDir PROPERTIES COMPILE_FLAGS "-Werror")
+ENDIF(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_INCLUDE_SYSTEM_FLAG_CXX)
+
#
# Extra coverage.Not used.
#
Index: complex.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/ComplexOneConfig/Executable/complex.cxx,v
retrieving revision 1.84.2.3
retrieving revision 1.84.2.5
diff -u -d -r1.84.2.3 -r1.84.2.5
--- complex.cxx 30 Jun 2006 17:48:48 -0000 1.84.2.3
+++ complex.cxx 13 Oct 2006 14:52:08 -0000 1.84.2.5
@@ -23,6 +23,12 @@
#include <string.h>
#endif
+#ifdef COMPLEX_TEST_LINK_STATIC
+extern "C"
+{
+ int TestLinkGetType();
+}
+#endif
int cm_passed = 0;
int cm_failed = 0;
@@ -102,7 +108,7 @@
orderLibs.DebugOn();
orderLibs.AddLinkExtension(".so");
orderLibs.AddLinkExtension(".a");
- orderLibs.SetLinkPrefix("lib");
+ orderLibs.AddLinkPrefix("lib");
cmTargetManifest manifest;
orderLibs.SetLinkInformation("test", linkLibraries, linkDirectories,
manifest, "");
@@ -438,6 +444,12 @@
cmPassed("COMPILE_FLAGS did work with SET_TARGET_PROPERTIES");
#endif
+#ifdef ELSEIF_RESULT
+ cmPassed("ELSEIF did work");
+#else
+ cmFailed("ELSEIF did not work");
+#endif
+
if(file2() != 1)
{
cmFailed("Call to file2 function from library failed.");
@@ -1270,7 +1282,18 @@
// Test the generated file stream.
TestCMGeneratedFileSTream();
#endif
-
+
+#ifdef COMPLEX_TEST_LINK_STATIC
+ if(TestLinkGetType())
+ {
+ cmPassed("Link to static over shared worked.");
+ }
+ else
+ {
+ cmFailed("Link to static over shared failed.");
+ }
+#endif
+
// ----------------------------------------------------------------------
// Summary
More information about the Cmake-commits
mailing list