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<ljth...@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
_______________________________________________
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