aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2014-10-23 08:41:39 -0700
committerGerald Combs <gerald@wireshark.org>2014-10-23 15:52:53 +0000
commitd2bb61a3a9ff29826aa332b7e4ee484f3a4746d9 (patch)
tree0f84a993eda44196d9ba2df4f48cdb0c0d9898a2 /CMakeLists.txt
parent97a920cb21c0617f78a03c33510594e9904fd052 (diff)
OS X: Integrate CMake and osx-app.sh
Add a -cb/--create-bundle option to osx-app.sh which builds the application bundle. Use it in Autotools. (CMake does this by default.) Copy over linker flags from configure.ac to CMakeLists.txt to support rpathification and code signing. Add an osx-app custom target to CMake. Change-Id: I6c20a1c27f8954aaea62904b7425b9312d994803 Reviewed-on: https://code.wireshark.org/review/4918 Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt37
1 files changed, 37 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 982103da9d..a6e4618039 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1119,6 +1119,38 @@ if( (BUILD_wireshark AND QT_FOUND) OR (BUILD_wireshark_gtk AND GTK_FOUND) )
endif()
if(ENABLE_APPLICATION_BUNDLE)
+ #
+ # Add -Wl,-single_module to the LDFLAGS used with shared
+ # libraries, to fix some error that show up in some cases;
+ # some Apple documentation recommends it for most shared
+ # libraries.
+ #
+ set( CMAKE_SHARED_LINKER_FLAGS "-Wl,-single_module ${CMAKE_SHARED_LINKER_FLAGS}" )
+ #
+ # Add -Wl,-headerpad_max_install_names to the LDFLAGS, as
+ # code-signing issues is running out of padding space.
+ #
+ # Add -Wl,-search_paths_first to make sure that if we search
+ # directories A and B, in that order, for a given library, a
+ # non-shared version in directory A, rather than a shared
+ # version in directory B, is chosen (so we can use
+ # --with-pcap=/usr/local to force all programs to be linked
+ # with a static version installed in /usr/local/lib rather than
+ # the system version in /usr/lib).
+ #
+ # Also add -Wl,-rpath,@executable_path/../lib and
+ # -Wl,-rpath,/usr/local/lib, so that, if we build an app
+ # bundle, we can tweak all the executable images, shared
+ # libraries, and plugins in the bundle to look for non-system
+ # libraries in the rpath, rather than having a script tweak
+ # DYLD_LIBRARY_PATH.
+ #
+
+ set(CMAKE_EXE_LINKER_FLAGS
+ "-Wl,-headerpad_max_install_names -Wl,-search_paths_first -Wl,-rpath,@executable_path/../lib -Wl,-rpath,@executable_path/../Frameworks -Wl,-rpath,/usr/local/lib ${CMAKE_EXE_LINKER_FLAGS}"
+ )
+
+ # Add files to the app bundle
# Wireshark.app/Contents
set(BUNDLE_CONTENTS_FILES
${CMAKE_BINARY_DIR}/packaging/macosx/PkgInfo
@@ -1618,6 +1650,11 @@ ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_BINARY_DIR}/packaging/macosx/PkgInfo
COMMAND ${CMAKE_COMMAND} -E echo APPLWshk > ${CMAKE_BINARY_DIR}/packaging/macosx/PkgInfo
)
+
+ADD_CUSTOM_TARGET(osx-app
+ COMMAND ${CMAKE_SOURCE_DIR}/packaging/macosx/osx-app.sh
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/run
+)
endif()
pod2manhtml( ${CMAKE_SOURCE_DIR}/doc/capinfos 1 )