[CMake] Conditional compilation of entire files
Mike Jackson
mike.jackson at bluequartz.net
Sun Jul 5 09:34:06 EDT 2009
I think this should work:
set (SRC_LIST Foo.cpp Bar.cpp)
OPTION(SOME_COOL_OPTION "Build Library with super cool option" ON)
if(SOME_COOL_OPTION)
set (SRC_LIST ${SRC_LIST} Bazz.cpp)
endif()
add_library (MyLibrary ${SRC_LIST})
Mike Jackson
On Sun, Jul 5, 2009 at 8:55 AM, Lucas Thode<ljthode at gmail.com> wrote:
> Hello CMake folks,
>
>
> I have a source file in my project that needs to be compiled into my project
> if and only if a certain configuration cache variable is set. How do I go
> about doing that, as it doesn't seem that you can append files to an
> add_library() statement once you've closed it already?
>
> Thanks,
> --Lucas
More information about the CMake
mailing list