2009/3/13 Denis Scherbakov <[email protected]>:
>
> Eric,
>
> Your solution requires a developer to know too much about the project, which 
> is not always true and basically to answer a full-scale questionnaire before 
> compilation. What if it is a new developer?

If it is not a developer there is a simpler solution, try to find all
what you can
in the main CMakeLists.txt and throw a "STATUS" message instead of FATAL
as told by Bill.

As regarding the OPTION solution, you may build your CMakeLists.txt to
automatically (and silently) put to ON all "buildable" parts (after trying
to find all dependencies).

Note that the drawback of the totally automatic thing is that you may search
for unwanted user things. Which may be a waste of time for him.

>  What if it is not a developer, but a user who expects everything to compile 
> automatically?

Then each "Not Found" message shuold tell him how to install dependencies.

>
> My question is simple:
>
> What is the way to get some code executed not during cmake-compilation, but 
> when a user types "gmake something" and it becomes clear which dependencies 
> are needed.

You ask to run CMake from make somehow. This should be doable with
add_custom_command / add_custom_target,
and a 2 steps make,  but I don't think  CMake  was meant for kind of
re-entrant usage, i.e. the build system (make, Visual Studio etc...)
calling the build generator (cmake). As far as I know this is currently done
only for checking if a CMakeLists.txt changed and it bothers some build system
like Visual Studio when they discover that the file they are using have been
changed during their own build.


Note however,
that here you expect your user to actually know that he wants
"something" to be build,
thus it is not "very" different (beside the syntactic sugar)
from requiring him to do:

cmake -DSOMETHING:BOOL=ON

when running cmake, it doesn't require much more knowledge but the name
the sub-projects he wants to build.


-- 
Erk
_______________________________________________
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