[CMake] Creating two libraries from the same set of source code, but with different compiler options

Eric Noulard eric.noulard at gmail.com
Fri Jun 19 13:59:15 EDT 2015


2015-06-19 19:17 GMT+02:00 Tom Kacvinsky <tom.kacvinsky at vectorcast.com>:

> I have need to build two libraries, each based on the same base code, but
> each library is built with different compiler options.  I know how to force
> the compilation options to be what I want, the problem I am having is
> envisioning how to do this within one CMakeLists.txt file.  What I am hung
> up on is this:  if I change the file properties, I am afraid the properties
> will apply to both libraries.  Is there a way of instruction cmake to apply
> those file properties to only one target, or will I have to split the
> building of the libraries into two CMakeLists.txt files?
>


The COMPILE_FLAGS property  may be set on a per-target basis and not source
file basis.

see
set_target_properties
vs
set_source_files_properties

 Eric

>
> Thanks,
>
> Tom
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
>



-- 
Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150619/d410ff19/attachment.html>


More information about the CMake mailing list