summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorMartin Kaiser <wireshark@kaiser.cx>2016-10-30 19:46:56 +0100
committerMartin Kaiser <wireshark@kaiser.cx>2016-11-07 21:16:30 +0000
commitddd1c87d43781533c3ec10279857e3870d12437e (patch)
tree1581a66553ec1267f157962e3ffba8e3f43d474f /cmake
parent1b91475e0da15e58a9df7cd0cee6a463a8e0c97e (diff)
downloadwireshark-ddd1c87d43781533c3ec10279857e3870d12437e.tar.gz
cmake: avoid leading space in linker options
This causes problems with cmake 2.8.9, which ships with Debian Wheezy. Reorder the linker options to avoid a leading space. According to GNU ld's manual, the order of linker options on the command line does not matter. This should be the same for Visual Studio's cl.exe and for clang's linker. See https://www.wireshark.org/lists/wireshark-dev/201604/msg00141.html for more details about the problem. Change-Id: Ieaf7425600d394f365b01747747665233693fea2 Reviewed-on: https://code.wireshark.org/review/18581 Petri-Dish: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/CheckCLinkerFlag.cmake7
1 files changed, 4 insertions, 3 deletions
diff --git a/cmake/modules/CheckCLinkerFlag.cmake b/cmake/modules/CheckCLinkerFlag.cmake
index 120471f182..d1723bae3b 100644
--- a/cmake/modules/CheckCLinkerFlag.cmake
+++ b/cmake/modules/CheckCLinkerFlag.cmake
@@ -33,6 +33,7 @@ MACRO (CHECK_C_LINKER_FLAG _FLAG _RESULT)
# set CMAKE_EXE_LINKER_FLAGS.
#
set(save_CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
+ set(CMAKE_REQUIRED_LIBRARIES "${_FLAG}")
if(CMAKE_C_COMPILER_ID MATCHES "MSVC")
#
# This means the linker is presumably the Microsoft linker;
@@ -40,16 +41,16 @@ MACRO (CHECK_C_LINKER_FLAG _FLAG _RESULT)
# rather than just complaining and driving on, if it's
# passed a flag it doesn't handle.
#
- set(CMAKE_REQUIRED_LIBRARIES "/WX")
+ set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES} /WX")
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
#
# We'll be running the linker through the compiler driver, so
# we may need to pass -Werror=unused-command-line-argument to have it
# fail, rather than just complaining and driving on, if it's
# passed a flag it doesn't handle.
- set(CMAKE_REQUIRED_LIBRARIES "-Werror=unused-command-line-argument")
+ set(CMAKE_REQUIRED_LIBRARIES
+ "${CMAKE_REQUIRED_LIBRARIES} -Werror=unused-command-line-argument")
endif()
- set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES} ${_FLAG}")
message(status "check linker flag - test linker flags: ${_FLAG}")
check_c_source_compiles("int main() { return 0;}" ${_RESULT})
set(CMAKE_REQUIRED_LIBRARIES "${save_CMAKE_REQUIRED_LIBRARIES}")