The "-include global/Include.h" works great, until it crosses paths with ExternalProject. It will probably work just as well in CMAKE_CXX_FLAGS.
I've got two potential workarounds in mind 1. Move the -include to CMAKE_CXX_FLAGS 2. Specify an explicit CONFIGURE_COMMAND and BUILD_COMMAND, so the parent project's configuration can't interfere with the child project. The documentation is not entirely clear to me on whether a given compiler argument should go in add_definitions or CMAKE_CXX_FLAGS. My understanding (from various posts I've found) is that they do the same thing, except that CMAKE_CXX_FLAGS sends args to the linker, as well as to the compiler. Since add_definitions is the one that's actually in the main documentation, I figured that was the one to go with. BTW, I also couldn't find in the documentation exactly what state of the parent CMake is supposed to effect the child CMake. I think the intent is that they are only related via the arguments to ExternalProject_Add (including their default values). I welcome all corrections to any misapprehensions I may have. Thank you, Todd Greer Principal Scientist, Affinegy, Inc. -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Bill Hoffman Sent: Thursday, February 21, 2013 8:31 PM To: [email protected] Subject: Re: [CMake] Internal CMake error with ExternalProject_Add and XCode On 2/21/2013 8:15 PM, Todd Greer wrote: > add_definitions(-include global/Include.h) > > We call CMake with these two lines in a shell script: cmake -G Xcode > .. cmake --build . --config Release > > It turns out that call to add_definitions is key. It worked perfectly > until we added in the ExternalProject_Add. I don't understand why they > interact, at all, but they do. So, does that flag work even in regular Xcode projects? I am thinking using add_definitions like that might be the problem. That is really a compiler flag. What if you put it in CMAKE_CXX_FLAGS or CMAKE_C_FLAGS? Is there another way to do that in your project? -- Bill Hoffman Kitware, Inc. 28 Corporate Drive Clifton Park, NY 12065 [email protected] http://www.kitware.com 518 881-4905 (Direct) 518 371-3971 x105 Fax (518) 371-4573 -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
