View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001479CMakepublic2005-01-13 19:502005-07-15 16:19
Reporterkarl 
Assigned ToBill Hoffman 
PriorityurgentSeveritymajorReproducibilityalways
StatusclosedResolutionno change required 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0001479: Multiple directories with main in sub-directory fails on the Mac
DescriptionI have a directory structure that looks like this

          top-level
exe dir1 dir2 dir3

In the exe directory I have the main.cpp and it links to libraries created in all the other sub directories. The CMakeLists.txt in the exe directory I set the the output path to
SET(EXECUTABLE_OUTPUT_PATH ${proj_BINARY_DIR})

and add the executable as follows
IF(APPLE)
   SET(GUI_EXECUTABLE MACOSX_BUNDLE)
ENDIF(APPLE)

ADD_EXECUTABLE(proj ${GUI_EXECUTABLE} ${PROJ_APP_SRCS} ${EXTRA_PROJ_APP_SRCS} ${PROJ_APP_HEADERS})

This works and creates the executable in the top-level directory on Windows, Linux, and several flavors of UNIX.

The Mac however is giving me some problems.

The target generated in the Makefile is
TARGETS = \
/Users/karl/build_proj/proj

but the build line in the generated Makefile is
/Users/karl/build_proj/proj.app/Contents/MacOS/proj: some list of dependencies

When the Makefile is executed it attempts to build TARGET but the requested target does not exist in the Makefile. I can cd to the exe directory and do a make /Users/karl/build_proj/proj.app/Contents/MacOS/proj and the final build step works correctly.

I have a very small sample case but I don't see a
place to make attachments. Contact me if you want
it.

This fails in 2.05 and the latest CVS release.
TagsNo tags attached.
Attached Filesgz file icon cmake_test.tar.gz [^] (878 bytes) 1969-12-31 19:00
gz file icon cmake_test1.tar.gz [^] (890 bytes) 1969-12-31 19:00
? file icon patch.file [^] (976 bytes) 1969-12-31 19:00

 Relationships

  Notes
(0001971)
karl (reporter)
2005-01-25 13:45

The second attachment gives a better error message. The first one just fails to make the executable but gives no errors. That could potentially be my problem so I would ignore the first attachment.
(0001977)
karl (reporter)
2005-01-26 10:01

 In short, the generated TARGET list and target name ( i.e. target: ) did not match when MACOSX_BUNDLE was defined. I grabbed the Apple specific code in cmLocalUnixMakefileGenerator::OutputExecutableRule and applied the same logic in cmLocalUnixMakefileGenerator::OutputTargetRules.

I have not run this through a large set of tests (although it works for my test case and a much larger app also) and I have only built it on the Mac. I did add a temporary variable that would be used on all platforms.
(0002663)
Bill Hoffman (manager)
2005-07-14 15:22

Is this still a problem in 2.1?
(0002664)
Bill Hoffman (manager)
2005-07-14 15:22

I meant to say 2.2 or cvs.
(0002692)
Bill Hoffman (manager)
2005-07-15 16:19

LIBRARY_OUTPUT_PATH must be a cmake cache variable and can not be done on a per directory basis. If I move
the SET(LIBRARY_OUTPUT_PATH to the toplevel cmakelist file, cmake_test.tar.gz works fine.


 Issue History
Date Modified Username Field Change


Copyright © 2000 - 2018 MantisBT Team