[CMake] ExternalProject unexpected behavior

Francisco Requena Espí frarees at gmail.com
Wed Jan 25 19:50:34 EST 2012


Hi,

I'm trying to build a very big project with some third party
dependencies, so I want to use ExternalProject capabilities. I'm
deploying on OSX with Xcode.

If I do:
(on the build dir)
$ cmake <src_dir> -D<args>
$ xcodebuild (or open the project with Xcode)

Then build, everything works great.

But, if I refer to him as an external project like so (in a CMakeLists.txt)

include(ExternalProject)
ExternalProject_Add(PROJ1 SOURCE_DIR <src_dir> CMAKE_ARGS -D<args>)

Then it fails building that specific target. Reading the resulting
cache, some logs, etc, I've observed that, only when including via
ExternalProject:

1. This fails to find the size:
include(CheckTypeSize)
CHECK_TYPE_SIZE("void*" PROJ1_PTR_SIZE BUILTIN_TYPES_ONLY)
if (PROJ1_PTR_SIZE EQUAL 8)
  ...
else ()
  ...
endif ()

2. Cache matches different values than when building standalone.
3. Some find_package() calls doesn't work the same way (no same results).

If I understood properly, ExternalProject should generate projects
that behave the same way than standalone ones. Is this correct?

Why this happens? What I'm doing wrong? Is it because there's no
support for ExternalProject and Xcode?

Thanks.


More information about the CMake mailing list