I want to generate an executable in a .bundle
file on Mac OSX 10.6.8
using CMake
. My CMakeLists.txt file looks like:
cmake_minimum_required(VERSION 2.8)
PROJECT(TESTProject)
SET(MACOSX_BUNDLE_BUNDLE_NAME TEST)
ADD_EXECUTABLE(TEST MACOSX_BUNDLE main.cpp)
SET_TARGET_PROPERTIES(TEST PROPERTIES MACOSX_BUNDLE TRUE)
Then I call CMake:
CMake -G"Xcode" .
However, when I compile this program with Xcode 3.2.1
, I constantly get a TEST.app
file instead of a TEST.bundle
file.
What am I doing wrong here?
For anyone who runs across this and is trying to build a library .bundle, this worked for me on CMake 3.0:
add_library(Foo MODULE ${SOURCES} ${HEADERS})
set_target_properties(Foo PROPERTIES BUNDLE TRUE)
The key is to use MODULE
not SHARED
. For some reason, CMake ignores the BUNDLE
property otherwise.
Use the BUNDLE_EXTENSION target property to get a different extension than the default. http://www.cmake.org/cmake/help/v2.8.10/cmake.html#prop_tgt:BUNDLE_EXTENSION
Also, I think .app is only the default for executable targets. For library or module targets, .bundle should be the default value.
Did you try with a library target?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With