[CMake] ExternalProject_Add() macro does not set CMAKE_COMPILER_IS_GNUCXX

fkillus fkillus at googlemail.com
Wed Jan 20 12:41:26 EST 2016


I have been trying to compile Ogre [1] as external dependency with
ExternalProject_Add(). In theory this should be straightforward since Ogre
itself also uses CMake as buildsystem. However, in the process I
encountered the following problem:

Ogre checks the value of the CMAKE_COMPILER_IS_GNUCXX variable in some
places (e.g. [2]). I am running Linux and compiling with g++ and everything
works fine if I manually configure Ogre with cmake or cmake-gui.
Unfortunately, after wrapping everything inside ExternalProject_Add(), the
CMAK_COMPILER_IS_GNUCXX variable is no longer being set correctly.

A simple workaround is to manually set this variable, i.e.:

 ExternalProject_Add(
    ogre
    URL https://bitbucket.org/sinbad/ogre/get/v1-9-0.zip
    CMAKE_ARGS
      -DCMAKE_INSTALL_PREFIX=${DEPENDENCIES_OUTPUT_DIR}
      -DCMAKE_COMPILER_IS_GNUCXX=${CMAKE_COMPILER_IS_GNUCXX}   # workaround
  )

This works, but I'm uncertain if this should be necessary. Is this a bug or
a feature?


[1] https://bitbucket.org/sinbad/ogre
[2]
https://bitbucket.org/sinbad/ogre/src/0d580c7216abe27fafe41cb43e31d8ed86ded591/CMake/Utils/OgreConfigTargets.cmake?at=default&fileviewer=file-view-default#OgreConfigTargets.cmake-277
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160120/df4b8e0d/attachment.html>


More information about the CMake mailing list