You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
1.2 KiB
30 lines
1.2 KiB
From: Ben Hutchings <ben@decadent.org.uk>
|
|
Subject: Do not use -fPIC when linking executables
|
|
cmake includes ${CMAKE_SHARED_LIBRARY_C_FLAGS} in the command line to
|
|
link an executable, and by default this is -fPIC. Either the use or
|
|
the definition of this variable is wrong, because executables should
|
|
not be linked with this option by default.
|
|
.
|
|
It's not entirely obvious how this variable gets into the command
|
|
line, but you can verify that it does by changing its value to e.g. -D
|
|
SHARED and running make VERBOSE=1.
|
|
.
|
|
Any special options needed for linking with shared libraries can be put
|
|
in CMAKE_SHARED_LIBRARY_LINK_C_FLAGS.
|
|
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=478404
|
|
|
|
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
|
|
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
|
|
@@ -199,11 +199,6 @@
|
|
std::string flags;
|
|
std::string linkFlags;
|
|
|
|
- // Add flags to deal with shared libraries. Any library being
|
|
- // linked in might be shared, so always use shared flags for an
|
|
- // executable.
|
|
- this->LocalGenerator->AddSharedFlags(linkFlags, linkLanguage, true);
|
|
-
|
|
// Add flags to create an executable.
|
|
this->LocalGenerator->
|
|
AddConfigVariableFlags(linkFlags, "CMAKE_EXE_LINKER_FLAGS",
|