View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007316CMakeCMakepublic2008-07-09 11:202008-07-16 10:40
ReporterMatt Leotta 
Assigned ToBill Hoffman 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product VersionCMake-2-6 
Target VersionFixed in Version 
Summary0007316: TRY_RUN fails to compile with generator for Xcode
DescriptionCMake 2.6.0 seems produces faulty Xcode projects for running TRY_RUN tests in some cases. These fail to compile. It seems to be related to the use of double quote characters in
CMAKE_FLAGS -DCOMPILE_DEFINTIONS:STRING=${SOME_STRING}

For example, if SOME_STRING is "-I \"/some/path\"" it will fail whereas if it is "-I /some/path" it will work fine. The quotes are needed in case the path contains spaces. This was discovered while compiling VXL. This comes up in the DETERMINE_TYPE macro in vxl/src/config/cmake/config/vxl_config_macros.cmake. As a result vxl_byte, vxl_int_32, etc are all defined to be void.
Additional InformationMac OS X 10.5.4 (Intel)
Xcode 3.0
CMake 2.6.0

I've attached a simple CMakeLists.txt file that isolates the problem.

The error message from TRY_RUN is:
Change Dir: /projects/test/my bin/CMakeFiles/CMakeTmp

Run Build Command:/Applications/CMake\ 2.6-0.app/Contents/bin/cmakexbuild -project
CMAKE_TRY_COMPILE.xcodeproj build -target cmTryCompileExec -configuration Debug
2008-07-09 08:32:20.045 xcodebuild[4650:613] CFPropertyListCreateFromXMLData():
        Old-style plist parser: missing semicolon in dictionary.
2008-07-09 08:32:20.046 xcodebuild[4650:613] XML parser error:
        Unexpected character / at line 1
Old-style plist parser error:
        Missing ';' on line 168
xcodebuild: Error: couldn't load project
        /projects/test/my bin/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.xcodeproj
TagsNo tags attached.
Attached Filestxt file icon CMakeLists.txt [^] (2,530 bytes) 2008-07-09 11:20 [Show Content]

 Relationships
related to 0007315closedBradley Lowekamp ITK XCode 3.0 builds of ITK fail in vnl_matlab_header.h 
related to 0004022closedBill Hoffman CMake Xcode generator produce invalid code when there is a quote in a string 

  Notes
(0012697)
Hans Johnson (reporter)
2008-07-14 17:09

This is the same problem as 0007315.
(0012699)
Brad King (manager)
2008-07-14 17:48

The fix to bug 0004022 introduced this bug. It added escaping to all string values in Xcode projects, but some values were already escaped.
(0012718)
Bill Hoffman (manager)
2008-07-16 09:27

I fixed the issue. However, this is a really bad way to do a try compile as the -I"path" does not work with several compilers. I added this as a test to cmake, and it failed on several compilers. For example on the sun it did this:


  /opt/SUNWspro/bin/CC -I
  "/home/kitware/Dashboards/MyTests/CMake-CC/Tests/TryCompile/CMakeTmp" -o
  CMakeFiles/cmTryCompileExec.dir/my_test.cxx.o -c
  /home/kitware/Dashboards/MyTests/CMake-CC/Tests/TryCompile/my_test.cxx

  CC: Invalid input file name
  /home/kitware/Dashboards/MyTests/CMake-CC/Tests/TryCompile/CMakeTmp, no
  output generated for this file.

Best to change the test to use INCLUDE_DIRECTORIES somehow.
(0012719)
Brad King (manager)
2008-07-16 09:33

FYI, you can specify include directories with this option:

CMAKE_FLAGS -DINCLUDE_DIRECTORIES:STRING=/some/include/dir;/other/include/dir
(0012720)
Matt Leotta (developer)
2008-07-16 09:41

Thanks, I will update the VXL tests using Brad's suggestion. But I have two questions:

Is it safe (or even appropriate) to use quotes with -DINCLUDE_DIRECTORIES if there is a possibility of spaces in the include path?

Is -DINCLUDE_DIRECTORIES supported in CMake 2.4? VXL is still supporting CMake >= 2.4.5
(0012721)
Brad King (manager)
2008-07-16 09:53

Will system include dirs really have spaces in the path? Anyway, the INCLUDE_DIRECTORIES thing is implemented by writing

  INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES})

in the generated CMakeLists.txt file. The INCLUDE_DIRECTORIES definition is expanded by the CMake language, which only separates on semicolon (not space). Therefore you should not have to quote anything. Of course it wouldn't hurt to quote it in the call to TRY_COMPILE:

  "-DINCLUDE_DIRECTORIES:STRING=/some/include/dir;/other/include/dir"

Oh, and this has been in CMake since 2002 so it's definately in 2.4.

 Issue History
Date Modified Username Field Change
2008-07-09 11:20 Matt Leotta New Issue
2008-07-09 11:20 Matt Leotta File Added: CMakeLists.txt
2008-07-14 17:09 Hans Johnson Note Added: 0012697
2008-07-14 17:28 Brad King Relationship added related to 0007315
2008-07-14 17:47 Brad King Relationship added related to 0004022
2008-07-14 17:48 Brad King Note Added: 0012699
2008-07-16 09:27 Bill Hoffman Note Added: 0012718
2008-07-16 09:33 Brad King Note Added: 0012719
2008-07-16 09:41 Matt Leotta Note Added: 0012720
2008-07-16 09:53 Brad King Note Added: 0012721
2008-07-16 10:40 Brad King Status new => assigned
2008-07-16 10:40 Brad King Assigned To => Bill Hoffman
2008-07-16 10:40 Brad King Status assigned => closed
2008-07-16 10:40 Brad King Resolution open => fixed


Copyright © 2000 - 2018 MantisBT Team