<div dir="ltr">Thanks for your suggestion! I consider trying it soon.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 20, 2016 at 11:44 PM, Craig Scott <span dir="ltr"><<a href="mailto:audiofanatic@gmail.com" target="_blank">audiofanatic@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">From: fkillus <<a href="mailto:fkillus@googlemail.com" target="_blank">fkillus@googlemail.com</a>><br>To: <a href="mailto:cmake@cmake.org" target="_blank">cmake@cmake.org</a><br>Cc: <br>Date: Wed, 20 Jan 2016 18:41:26 +0100<br>Subject: [CMake] ExternalProject_Add() macro does not set CMAKE_COMPILER_IS_GNUCXX<br><div dir="ltr"><div><div>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:</div></div></div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><div><br></div>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.<br></div><div><div><div><div><div><div><div><br></div><div>A simple workaround is to manually set this variable, i.e.:<br><br></div><div><pre> ExternalProject_Add(
    ogre
    URL <a href="https://bitbucket.org/sinbad/ogre/get/v1-9-0.zip" target="_blank">https://bitbucket.org/sinbad/ogre/get/v1-9-0.zip</a>
    CMAKE_ARGS
      -DCMAKE_INSTALL_PREFIX=${DEPENDENCIES_OUTPUT_DIR}
      -DCMAKE_COMPILER_IS_GNUCXX=${CMAKE_COMPILER_IS_GNUCXX}   # workaround
  )</pre>This works, but I'm uncertain if this should be necessary. Is this a bug or a feature?<br></div><div><br><br>[1] <a href="https://bitbucket.org/sinbad/ogre" target="_blank">https://bitbucket.org/sinbad/ogre</a><br>[2] <a href="https://bitbucket.org/sinbad/ogre/src/0d580c7216abe27fafe41cb43e31d8ed86ded591/CMake/Utils/OgreConfigTargets.cmake?at=default&fileviewer=file-view-default#OgreConfigTargets.cmake-277" target="_blank">https://bitbucket.org/sinbad/ogre/src/0d580c7216abe27fafe41cb43e31d8ed86ded591/CMake/Utils/OgreConfigTargets.cmake?at=default&fileviewer=file-view-default#OgreConfigTargets.cmake-277</a><br></div></div></div></div></div></div></div></div>
<br></blockquote><div><br></div><div><br></div><div><div>Since Ogre is a CMake project, you may find the technique described at the following link useful. It uses GoogleTest as its example, but it should also apply to your situation. The approach uses ExternalProject only to download the source at CMake time. It then pulls it into your normal build via add_subdirectory(), so it gets all the same compiler details, etc. as your main build because it IS part of your main build.</div><div><br></div><div><a href="http://crascit.com/2015/07/25/cmake-gtest/" target="_blank">http://crascit.com/2015/07/25/cmake-gtest/</a><br></div><div><br></div><div>I am not familiar with Ogre's build, so I can't comment on whether it will play nice if pulled into a parent build like this, but it's worth a try. The article links to a github repo which provides a fully generalised implementation you should be able to use out of the box.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>  </div></font></span></div></div><span class="HOEnZb"><font color="#888888">-- <br><div><div dir="ltr"><div>Craig Scott<br>Melbourne, Australia</div><div><a href="http://crascit.com" target="_blank">http://crascit.com</a></div></div></div>
</font></span></div></div>
<br>--<br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/cmake" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a><br></blockquote></div><br></div>