MantisBT - CMake
View Issue Details
0008406CMakeCMakepublic2009-01-20 08:242009-01-20 15:51
Nicolas Despres 
Brad King 
normalminoralways
closedfixed 
CMake-2-6 
 
0008406: Wrong LOCATION_<CONFIG> property value with MACOSX_BUNDLE option set
Consider a simple helloworld project with the following CMakeLists.txt:
===
cmake_minimum_required(VERSION 2.6.2)
#set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/modules")

project(helloworld)

add_executable(helloworld MACOSX_BUNDLE
  main.cc
  )
get_target_property(binary_loc helloworld LOCATION_${CMAKE_BUILD_TYPE})
get_target_property(binary_loc2 helloworld LOCATION)
get_target_property(pkg_loc helloworld MACOSX_PACKAGE_LOCATION)
get_target_property(output_name helloworld OUTPUT_NAME)
get_target_property(is_bundle helloworld MACOSX_BUNDLE)
get_target_property(bundle_info_plist helloworld MACOSX_BUNDLE_INFO_PLIST)
get_target_property(framework_info_plist helloworld MACOSX_FRAMEWORK_INFO_PLIST)
message("CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}")
message("binary_loc=${binary_loc}")
message("binary_loc2=${binary_loc2}")
message("pkg_loc=${pkg_loc}")
message("output_name=${output_name}")
message("is_budle=${is_bundle}")
message("bundle_info_plist=${bundle_info_plist}")
message("framework_info_plist=${framework_info_plist}")
===
Running: cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release ..
Produces the following output:
===
CMAKE_BUILD_TYPE=Release
binary_loc=/Users/polrop/src/helloworld/_build/helloworld
binary_loc2=/Users/polrop/src/helloworld/_build/helloworld
pkg_loc=/Users/polrop/src/helloworld/_build/helloworld
output_name=output_name-NOTFOUND
is_budle=ON
bundle_info_plist=bundle_info_plist-NOTFOUND
framework_info_plist=framework_info_plist-NOTFOUND
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/polrop/src/helloworld/_build
===

I would have expected `binary_loc' to be equal to /Users/polrop/src/helloworld/_build/helloworld.app/Contents/MacOS/helloworld

The attached patch fix it, but I'm not sure I did it the right way.
No tags attached.
patch bundle_localtion.patch (496) 2009-01-20 08:24
https://public.kitware.com/Bug/file/2003/bundle_localtion.patch
Issue History
2009-01-20 08:24Nicolas DespresNew Issue
2009-01-20 08:24Nicolas DespresFile Added: bundle_localtion.patch
2009-01-20 09:58Bill HoffmanStatusnew => assigned
2009-01-20 09:58Bill HoffmanAssigned To => Brad King
2009-01-20 15:51Brad KingNote Added: 0014646
2009-01-20 15:51Brad KingStatusassigned => closed
2009-01-20 15:51Brad KingResolutionopen => fixed

Notes
(0014646)
Brad King   
2009-01-20 15:51   
I've committed the complete fix.

/cvsroot/CMake/CMake/Source/cmExportBuildFileGenerator.cxx,v <-- Source/cmExportBuildFileGenerator.cxx
new revision: 1.7; previous revision: 1.6
/cvsroot/CMake/CMake/Source/cmGlobalXCodeGenerator.cxx,v <-- Source/cmGlobalXCodeGenerator.cxx
new revision: 1.204; previous revision: 1.203
/cvsroot/CMake/CMake/Source/cmTarget.cxx,v <-- Source/cmTarget.cxx
new revision: 1.232; previous revision: 1.231

This also fixes the case of a loadable module (plugin) which 'links' to an application bundle as its loader.