summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Malak <malak.jiri@gmail.com>2014-03-24 11:33:11 (GMT)
committerBrad King <brad.king@kitware.com>2014-03-24 13:11:48 (GMT)
commit1b18f442f48ebd8f88c1f64ef016784613cc2f2d (patch)
treee55639ac47615bb4c97d72729d00af54914b3d0d
parent8a306d68e02595a8fc119cf7e2fa267a6ea64498 (diff)
downloadCMake-1b18f442f48ebd8f88c1f64ef016784613cc2f2d.zip
CMake-1b18f442f48ebd8f88c1f64ef016784613cc2f2d.tar.gz
CMake-1b18f442f48ebd8f88c1f64ef016784613cc2f2d.tar.bz2
Avoid trailing space in CMAKE_*_LINKER_FLAGS when LDFLAGS is empty
-rw-r--r--Modules/CMakeCommonLanguageInclude.cmake18
1 files changed, 12 insertions, 6 deletions
diff --git a/Modules/CMakeCommonLanguageInclude.cmake b/Modules/CMakeCommonLanguageInclude.cmake
index 38a6d35..fa025a8 100644
--- a/Modules/CMakeCommonLanguageInclude.cmake
+++ b/Modules/CMakeCommonLanguageInclude.cmake
@@ -16,9 +16,11 @@
# cache values that can be initialized in the platform-compiler.cmake file
# it may be included by more than one language.
-set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS_INIT} $ENV{LDFLAGS}"
- CACHE STRING "Flags used by the linker.")
-
+if(NOT "x$ENV{LDFLAGS}" STREQUAL "x")
+ set (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} $ENV{LDFLAGS}")
+ set (CMAKE_SHARED_LINKER_FLAGS_INIT "${CMAKE_SHARED_LINKER_FLAGS_INIT} $ENV{LDFLAGS}")
+ set (CMAKE_MODULE_LINKER_FLAGS_INIT "${CMAKE_MODULE_LINKER_FLAGS_INIT} $ENV{LDFLAGS}")
+endif()
if(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
# default build type is none
@@ -82,12 +84,17 @@ if(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
${CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO_INIT} CACHE STRING
"Flags used by the linker during Release with Debug Info builds.")
endif()
+
+# executable linker flags
+set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS_INIT}"
+ CACHE STRING "Flags used by the linker.")
+
# shared linker flags
-set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS_INIT} $ENV{LDFLAGS}"
+set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS_INIT}"
CACHE STRING "Flags used by the linker during the creation of dll's.")
# module linker flags
-set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS_INIT} $ENV{LDFLAGS}"
+set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS_INIT}"
CACHE STRING "Flags used by the linker during the creation of modules.")
# static linker flags
@@ -124,4 +131,3 @@ CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL
CMAKE_STATIC_LINKER_FLAGS_RELEASE
CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO
)
-