[CMake] build type per target?

Alexander Neundorf a.neundorf-work at gmx.net
Sun Jun 15 15:02:19 EDT 2008


On Sunday 15 June 2008, Dave Milter wrote:
> In my project I have plugin for qt designer,
> it should be build in release mode, because of in other case qt
> designer will not load and use it.
>
> >From other hand I need this  code as static library,
>
> and use build type the same as my main application uses.
>
> So it looks like
>
> add_library(some_name SHARED
>  ${some_code}
>  ${extra_code}
> )
>
> add_library(some_name1 STATIC
>  ${some_code}
> )
>
> And I would like to have build type for "some_name" = Release,
> and for "some_name1" the same mode as CMAKE_BUILD_TYPE,
> is it possible?

I think this is currently not possible.
You could set the COMPILE_FLAGS property for the specific targets.
I'm not quite sure how the CMAKE_CXX_COMPILER_FLAGS and friends are handled, 
if they are project-global (I don't think so), ot directory-global (maybe) or 
local where they appear (also maybe).
You could set these variables just as you need them and see what happens.

Alex


More information about the CMake mailing list