[cmake-commits] alex committed cmAddLibraryCommand.cxx 1.28 1.29

cmake-commits at cmake.org cmake-commits at cmake.org
Thu Jun 21 16:23:56 EDT 2007


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv6053/Source

Modified Files:
	cmAddLibraryCommand.cxx 
Log Message:

ENH: print a warning if ADD_LIBRARY( SHARED/MODULE ) is used and the target
platform doesn't support shared libraries

Alex


Index: cmAddLibraryCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmAddLibraryCommand.cxx,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- cmAddLibraryCommand.cxx	12 Mar 2007 14:26:59 -0000	1.28
+++ cmAddLibraryCommand.cxx	21 Jun 2007 20:23:54 -0000	1.29
@@ -77,6 +77,22 @@
     cmSystemTools::Message(msg.c_str() ,"Warning");
     }
 
+  /* ideally we should check whether for the linker language of the target 
+    CMAKE_${LANG}_CREATE_SHARED_LIBRARY is defined and if not default to
+    STATIC. But at this point we know only the name of the target, but not 
+    yet its linker language. */
+  if ((shared != 0) && 
+       (this->Makefile->IsOn("CMAKE_TARGET_SUPPORTS_ONLY_STATIC_LIBS")))
+    {
+    std::string msg = "ADD_LIBRARY for library ";
+    msg += args[0];
+    msg += " is used with the SHARED or MODULE option, but the target "
+        "platform supports only STATIC libraries. Building it STATIC instead. "
+        "This may lead to problems.";
+    cmSystemTools::Message(msg.c_str() ,"Warning");
+    shared = 0;
+    }
+
   std::vector<std::string> srclists;
   while (s != args.end()) 
     {



More information about the Cmake-commits mailing list