[CMake] Recompile with different flags
Philip Lowman
philip at yhbt.com
Mon Jan 19 17:48:16 EST 2009
On Mon, Jan 19, 2009 at 4:44 PM, Adam Weiss
<cseadam+cmake at gmail.com<cseadam%2Bcmake at gmail.com>
> wrote:
> I am still fairly new to cmake, and I am not sure how to make
> configurations. Let me see if I can provide some more details.
>
> The hope is that a third party can run:
>
> mkdir build
> cd build
> cmake ..
> make
>
> and have both libraries built. A less graceful way I was considering
> was to have cmake copy all the files that need the flag set and then
> use the copies to build the second version of the library. If you
> could elaborate on how to build configurations of a library I would
> appreciate it.
Sounds like you could call add_library() twice and use the COMPILE_FLAGS
property on each target?
set(my_SRCS foo.h foo.cc)
add_library(foo ${my_SRCS})
set_target_properties(foo PROPERTIES COMPILE_FLAGS "-DFOO")
add_library(foo2 ${my_SRCS})
set_target_properties(foo2 PROPERTIES COMPILE_FLAGS "-DFOO2")
--
Philip Lowman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090119/8a2e897d/attachment.htm>
More information about the CMake
mailing list