[CMake] Fwd: set_target_properties and language specific COMPILE_FLAGS

Nicolas Bock nicolasbock at gmail.com
Mon Aug 4 17:00:21 EDT 2014


Hi Chuck,

seems a bit hackish, but works for me :)

Thanks for the trick!

nick

On Fri, Aug 1, 2014 at 12:37 PM, Chuck Atkins <chuck.atkins at kitware.com> wrote:
> Hi Nick,
>
> You could split your target in to two object libraries that combine into a
> singe "real" library:
>
> add_library(foo_f OBJECT ${FOO_F_SOURCES})
> # set necessary compile flags specific to the Fortran components
> # on the foo_f target
>
> add_library(foo_c OBJECT ${FOO_C_SOURCES})
> # set necessary compile flags specific to the C components
> # on the foo_c target
>
> # Combine into a "real" library
> add_library(foo $<TARGET_OBJECTS:foo_f> $<TARGET_OBJECTS:foo_c>)
>
> See http://www.cmake.org/Wiki/CMake/Tutorials/Object_Library
>
> - Chuck
>
>
> On Fri, Aug 1, 2014 at 12:54 PM, Nicolas Bock <nicolasbock at gmail.com> wrote:
>>
>> Hi,
>>
>> I am building a library containing Fortran and C sources. I would like
>> to add language specific compile flags without affecting the global
>> compile flags:
>>
>> set_target_properties( foo PROPERTIES C_FLAGS "-fopenmp" Fortran_FLAGS
>> "-openmp" )
>>
>> However, it seems there is only COMPILE_FLAGS which presumably affects
>> both languages.
>>
>> Thanks already,
>>
>> nick
>> --
>>
>> 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
>
>


More information about the CMake mailing list