diff --git a/CMakeLists.txt b/CMakeLists.txt index cc10e57d1..759fe9b42 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -354,6 +354,9 @@ IF(APPLE) ENDIF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk) ENDIF(EXISTS /Developer/SDKs/10.5.sdk) ENDIF(NOT OSG_CONFIG_HAS_BEEN_RUN_BEFORE) + + OPTION(OSG_BUILD_APPLICATION_BUNDLES "Enable the building of applications and examples as OSX Bundles" OFF) + ENDIF(APPLE) diff --git a/CMakeModules/OsgMacroUtils.cmake b/CMakeModules/OsgMacroUtils.cmake index 91d9fa6c7..188da4119 100644 --- a/CMakeModules/OsgMacroUtils.cmake +++ b/CMakeModules/OsgMacroUtils.cmake @@ -171,11 +171,19 @@ MACRO(SETUP_EXE IS_COMMANDLINE_APP) # SET(MACOSX_BUNDLE_INFO_STRING "Info string, localized?") ENDIF(APPLE) - IF(WIN32 AND REQUIRE_WINMAIN_FLAG) - ADD_EXECUTABLE(${TARGET_TARGETNAME} WIN32 ${TARGET_SRC} ${TARGET_H}) - ELSE(WIN32 AND REQUIRE_WINMAIN_FLAG) - ADD_EXECUTABLE(${TARGET_TARGETNAME} MACOSX_BUNDLE ${TARGET_SRC} ${TARGET_H}) - ENDIF(WIN32 AND REQUIRE_WINMAIN_FLAG) + IF(WIN32) + IF (REQUIRE_WINMAIN_FLAG) + SET(PLATFORM_SPECIFIC_CONTROL WIN32) + ENDIF(REQUIRE_WINMAIN_FLAG) + ENDIF(WIN32) + + IF(APPLE) + IF(OSG_BUILD_APPLICATION_BUNDLES) + SET(PLATFORM_SPECIFIC_CONTROL MACOSX_BUNDLE) + ENDIF(OSG_BUILD_APPLICATION_BUNDLES) + ENDIF(APPLE) + + ADD_EXECUTABLE(${TARGET_TARGETNAME} ${PLATFORM_SPECIFIC_CONTROL} ${TARGET_SRC} ${TARGET_H}) ENDIF(${IS_COMMANDLINE_APP}) SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PROJECT_LABEL "${TARGET_LABEL}")