[CMake] 1 tricky question, 1 bug report
Eric Noulard
eric.noulard at gmail.com
Fri Mar 13 12:51:20 EDT 2009
2009/3/13 Denis Scherbakov <denis_scherbakov at yahoo.com>:
>
> As I already wrote, my problem is that "IF ( NOT MICO_FOUND )" code is executed too early - during compilation by cmake, not when user types "gmake puts" and it becomes clear that MICO is needed.
That's the expected behavior, because CMake tries to find libXml2/Mico
** at CMake time ** , i.e. when CMake runs not when building (i.e.
when gmake runs in your case).
If you want to authorize a user to compile a sub-project without having
the required libs installed used by other sub-project you should make
** the configuration ** of those sub-project optional and not
** their compilation **
You may use CMake "OPTION" for that purpose:
OPTION(BUILD_PRINTF "Build the PRINTF Sub-project" ON)
OPTION(BUILD_PUTS "Build the PUTS Sub-project" ON)
IF (BUILD_PRINTF)
ADD_SUBDIRECTORY("printf")
ENDIF(BUILD_PRINTF)
IF (BUILD_PUTS)
ADD_SUBDIRECTORY("puts")
ENDIF (BUILD_PUTS)
When calling CMake your user/developper may decide not to compile
some sub-project:
cmake -DBUILD_PRINTF:BOOL=OFF
in this case the default is to build both.
--
Erk
More information about the CMake
mailing list