1
0
Эх сурвалжийг харах

Drop executable symbol export if platform does not support shared libs

Instead of always adding CMAKE_SHARED_LIBRARY_LINK_<LANG>_FLAGS to
executables, or just when the ENABLE_EXPORTS property is set (CMP0065),
make sure that the target platform also actually supports shared
libraries.  If not, then the executable cannot possibly provide symbols
to them anyway.
Chuck Atkins 10 жил өмнө
parent
commit
e90f463a31

+ 3 - 1
Source/cmLocalGenerator.cxx

@@ -1542,7 +1542,9 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
     this->Makefile->GetSafeDefinition("CMAKE_LIBRARY_PATH_TERMINATOR");
     this->Makefile->GetSafeDefinition("CMAKE_LIBRARY_PATH_TERMINATOR");
 
 
   // Flags to link an executable to shared libraries.
   // Flags to link an executable to shared libraries.
-  if( tgt.GetType() == cmTarget::EXECUTABLE )
+  if (tgt.GetType() == cmTarget::EXECUTABLE &&
+      this->StateSnapshot.GetState()->
+        GetGlobalPropertyAsBool("TARGET_SUPPORTS_SHARED_LIBS"))
     {
     {
     bool add_shlib_flags = false;
     bool add_shlib_flags = false;
     switch(tgt.Target->GetPolicyStatusCMP0065())
     switch(tgt.Target->GetPolicyStatusCMP0065())