[CMake] How can I automatically optionally build a submodule?
Steve Keller
keller.steve at gmx.de
Wed Mar 27 15:18:59 EDT 2019
"Simon Richter" <Simon.Richter at hogyros.de> wrote:
> With my Debian Developer hat on: please also add a mechanism to manually
> specify whether the optional component should be built. If the
> dependency changes and suddenly a component goes missing without
> triggering a build failure, that can be rather annoying for users.
>
> Without a package system, this also means that old files may stick
> around after installation, so your program should be aware that
> installed plugins could be built against an older API and weren't
> updated during the last install run.
I'd like to do that if I'd know how to achieve that using cmake. But I find
cmake is much too large and is incapable of many things I'd expect from
a build system tool. It also makes development ugly for the Unix accustomed
developer, only to make things portable to Windows, which I don't want anyway.
Currently, we have a shell script wrapper around cmake that does something like
if [ <dependencies for foo available> ]; then
BUILD_FOO=true
else
BUILD_FOO=false
fi
and in CMakeLists.txt
set(BUILD_FOO "true" CACHE BOOL "description")
...
if (BUILD_FOO)
add_subdirectory(foo)
endif()
This is *ugly* but I don't know how to do this in cmake.
Steve
More information about the CMake
mailing list