Hi Jakub,

On Fri, Dec 7, 2012 at 4:46 PM, Jakub Zakrzewski <jzakrzew...@e2e.ch> wrote:
> Hi
> Did you think about something like this:
>
> ADD_DEFINITIONS (-DBOOST_ALL_NO_LIB)
> SET (BOOST_ROOT $ENV{BOOST_ROOT})
> SET (Boost_NO_SYSTEM_PATHS ON)
> SET (Boost_USE_MULTITHREADED ON)
> SET (Boost_USE_STATIC_RUNTIME OFF)
> IF (TARGET parent)
> FIND_PACKAGE (Boost 1.42.0 REQUIRED COMPONENTS system)
>   IF (Boost_FOUND)
>     LINK_DIRECTORIES (${Boost_LIBRARY_DIRS})
>     INCLUDE_DIRECTORIES (${Boost_INCLUDE_DIRS})
>     TARGET_LINK_LIBRARIES (parent ${Boost_LIBRARIES})
>   ENDIF ()
> ENDIF (TARGET parent)


How embarrassing...yes, what you suggested of just putting the search
in the IF statement worked.  Unfortunately, getting it right made me
realize I had problems elsewhere in my CMakeLists.txt (in particular,
it wasn't conditionally defining the target properly).

In the end, I added:

IF ("${PROJECT_NAME}" STREQUAL "")
        PROJECT (child CXX)
ENDIF ("${PROJECT_NAME}" STREQUAL "")

and likewise to the ADD_EXECUTABLE () in all of my CMakeLists.txt.  I
don't know if this is the right way to do it, but it seems ok so
far...

Yes, in hindsight, what you suggested was obvious but I was so fixated
on something more complicated; the obvious eluded me!  Thank you for
your help!

Ray
--

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

Reply via email to