summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorMartin Kaiser <wireshark@kaiser.cx>2016-11-08 15:30:45 +0100
committerMartin Kaiser <wireshark@kaiser.cx>2016-11-08 16:22:30 +0000
commit4e95d5fa8e2f7fec72f0d7350a0b07ca8cdfa12b (patch)
tree446a7b297631905193a0e72a0095c449d61fa748 /cmake
parent7531318e054153fbd5e33624ef30314acd52b6bc (diff)
downloadwireshark-4e95d5fa8e2f7fec72f0d7350a0b07ca8cdfa12b.tar.gz
cmake: fix the linker flags test for Visual Studio
ddd1c87d43781533c3ec10279857e3870d12437e modified the order of linker command line options. This broke the tests and made invalid linker flags seem valid. (Link target) -> LINK : warning LNK4044: unrecognized option '/Wl,--as-needed'; ignored [C:\wireshark\build3\wsutil\wsutil.vcxproj] LINK : warning LNK4044: unrecognized option '/pie'; ignored [C:\wireshark\build3\wsutil\wsutil.vcxproj] The simple fix is to add specific options for Visual Studio and clang at the beginning of the linker's command line options rather than at the end. Change-Id: I6492ea1271e18be0d190e7579f47baecf6ac4d61 Reviewed-on: https://code.wireshark.org/review/18709 Petri-Dish: Martin Kaiser <wireshark@kaiser.cx> Reviewed-by: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Graham Bloice <graham.bloice@trihedral.com> Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/CheckCLinkerFlag.cmake4
1 files changed, 2 insertions, 2 deletions
diff --git a/cmake/modules/CheckCLinkerFlag.cmake b/cmake/modules/CheckCLinkerFlag.cmake
index d1723bae3b..283c188141 100644
--- a/cmake/modules/CheckCLinkerFlag.cmake
+++ b/cmake/modules/CheckCLinkerFlag.cmake
@@ -41,7 +41,7 @@ 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 "${CMAKE_REQUIRED_LIBRARIES} /WX")
+ set(CMAKE_REQUIRED_LIBRARIES "/WX ${CMAKE_REQUIRED_LIBRARIES}")
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
#
# We'll be running the linker through the compiler driver, so
@@ -49,7 +49,7 @@ MACRO (CHECK_C_LINKER_FLAG _FLAG _RESULT)
# fail, rather than just complaining and driving on, if it's
# passed a flag it doesn't handle.
set(CMAKE_REQUIRED_LIBRARIES
- "${CMAKE_REQUIRED_LIBRARIES} -Werror=unused-command-line-argument")
+ "-Werror=unused-command-line-argument ${CMAKE_REQUIRED_LIBRARIES}")
endif()
message(status "check linker flag - test linker flags: ${_FLAG}")
check_c_source_compiles("int main() { return 0;}" ${_RESULT})