[CMake] One more problem with Xcode generation

Bill Hoffman bill.hoffman at kitware.com
Wed Jul 16 14:30:55 EDT 2008


Carminati Federico wrote:
> Hello,
>    The following simple CMakeLists.txt works when generating unix 
> makefiles but fails when generating xcode project:
> 
> # -*- mode: cmake -*-
> Project(Test)
> Cmake_Minimum_Required(VERSION 2.6)
> Set(CMAKE_VERBOSE_MAKEFILE ON)
> Set(DATEFLAGS "-D`uname` -Dlong64=\"long long\"")
> Set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} ${DATEFLAGS})
> Add_Executable(hello hello.cxx)
> 
> I am using the cvs version of cmake. The problem is that the compilation 
> lines becomes
> 
> -D`uname` "-Dlong64=long long"
> 
> in the xcode project, while it is
> 
> -D`uname` -Dlong64="long long"
> 
> in the Unix makefile. I know that what I am doing is not elegant and I 
> should rather execute the uname command and so on, however fact is that 
> cmake is inconsistent in the two cases. Best,
> 

Back tick commands are not supported in cmake.  You should use 
execute_process and capture the output.

-Bill


More information about the CMake mailing list