aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorJörg Mayer <jmayer@loplof.de>2010-03-18 10:27:17 +0000
committerJörg Mayer <jmayer@loplof.de>2010-03-18 10:27:17 +0000
commit96779de920fa5f308f29c35dce54d48e5d19b670 (patch)
tree447b5cb2f49d91c4f87cd170ac0fe6f6b032117a /CMakeLists.txt
parent1e0bcd0740f5c3f71a6e194d0f09deef0489d53d (diff)
cmake changes:
- Add checking for linker flags - Install plugins with the name including the Wireshark version. This will make it easier to find matching plugin versions if files get just copied over. svn path=/trunk/; revision=32231
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt36
1 files changed, 30 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ee7a405d25..8fefccc917 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -213,12 +213,26 @@ else()
add_definitions( -D_U_=\"\" )
endif()
-# todo
-# Same for linker flags, but it looks like it's do-it-yourself here
-# AC_WIRESHARK_GCC_LDFLAGS_CHECK([-Wl,--as-needed])
-# AC_WIRESHARK_GCC_LDFLAGS_CHECK([-flto])
-# AC_WIRESHARK_GCC_LDFLAGS_CHECK([-fwhopr])
-# AC_WIRESHARK_GCC_LDFLAGS_CHECK([-fwhole-program])
+set(WIRESHARK_LD_FLAGS
+ -Wl,--as-needed
+ # -flto
+ # -fwhopr
+ # -fwhole-program
+)
+
+include(CheckCLinkerFlag)
+set(C 0)
+# Sigh: Have to use THIS_FLAG instead of ${F} for some reason
+foreach(THIS_FLAG ${WIRESHARK_LD_FLAGS})
+ set(F WS_LD_FLAG_${C})
+ set(${F} ${THIS_FLAG})
+ set(V WS_LD_FLAG_VALID${C})
+ check_c_linker_flag(${${F}} ${V})
+ if (${${V}})
+ set(WS_LINK_FLAGS ${WS_LINK_FLAGS} ${${F}})
+ endif()
+ math(EXPR C "${C} + 1")
+endforeach()
if(ENABLE_STATIC)
set(LINK_MODE_LIB STATIC)
@@ -643,6 +657,7 @@ if(BUILD_wireshark)
)
add_executable(wireshark ${wireshark_FILES})
add_dependencies(wireshark svnversion)
+ set_target_properties(wireshark PROPERTIES LINK_FLAGS ${WS_LINK_FLAGS})
target_link_libraries(wireshark ${wireshark_LIBS})
install(TARGETS wireshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
@@ -664,6 +679,7 @@ if(BUILD_tshark)
)
add_executable(tshark ${tshark_FILES})
add_dependencies(tshark svnversion)
+ set_target_properties(tshark PROPERTIES LINK_FLAGS ${WS_LINK_FLAGS})
target_link_libraries(tshark ${tshark_LIBS})
install(TARGETS tshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
@@ -679,6 +695,7 @@ if(BUILD_rawshark)
)
add_executable(rawshark ${rawshark_FILES})
add_dependencies(rawshark svnversion)
+ set_target_properties(rawshark PROPERTIES LINK_FLAGS ${WS_LINK_FLAGS})
target_link_libraries(rawshark ${rawshark_LIBS})
install(TARGETS rawshark RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
@@ -692,6 +709,7 @@ if(BUILD_dftest)
util.c
)
add_executable(dftest ${dftest_FILES})
+ set_target_properties(dftest PROPERTIES LINK_FLAGS ${WS_LINK_FLAGS})
target_link_libraries(dftest ${dftest_LIBS})
install(TARGETS dftest RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
@@ -711,6 +729,7 @@ if(BUILD_randpkt)
randpkt.c
)
add_executable(randpkt ${randpkt_FILES})
+ set_target_properties(randpkt PROPERTIES LINK_FLAGS ${WS_LINK_FLAGS})
target_link_libraries(randpkt ${randpkt_LIBS})
install(TARGETS randpkt RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
@@ -729,6 +748,7 @@ if(BUILD_text2pcap)
)
add_executable(text2pcap ${text2pcap_FILES})
add_dependencies(text2pcap svnversion)
+ set_target_properties(text2pcap PROPERTIES LINK_FLAGS ${WS_LINK_FLAGS})
target_link_libraries(text2pcap ${text2pcap_LIBS})
install(TARGETS text2pcap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
@@ -745,6 +765,7 @@ if(BUILD_mergecap)
)
add_executable(mergecap ${mergecap_FILES})
add_dependencies(mergecap svnversion)
+ set_target_properties(mergecap PROPERTIES LINK_FLAGS ${WS_LINK_FLAGS})
target_link_libraries(mergecap ${mergecap_LIBS})
install(TARGETS mergecap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
@@ -761,6 +782,7 @@ if(BUILD_capinfos)
${WTAP_PLUGIN_SOURCES}
)
add_executable(capinfos ${capinfos_FILES})
+ set_target_properties(capinfos PROPERTIES LINK_FLAGS ${WS_LINK_FLAGS})
target_link_libraries(capinfos ${capinfos_LIBS})
install(TARGETS capinfos RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
@@ -778,6 +800,7 @@ if(BUILD_editcap)
)
add_executable(editcap ${editcap_FILES})
add_dependencies(editcap svnversion)
+ set_target_properties(editcap PROPERTIES LINK_FLAGS ${WS_LINK_FLAGS})
target_link_libraries(editcap ${editcap_LIBS})
install(TARGETS editcap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
@@ -812,6 +835,7 @@ if(BUILD_dumpcap)
)
add_executable(dumpcap ${dumpcap_FILES})
add_dependencies(dumpcap svnversion)
+ set_target_properties(dumpcap PROPERTIES LINK_FLAGS ${WS_LINK_FLAGS})
target_link_libraries(dumpcap ${dumpcap_LIBS})
install(TARGETS dumpcap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()