target_compile_features question

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

target_compile_features question

Jan Christoph Uhde
Hi,

I have a project using CMake 3.9.
The project contains a header only library mylib.
The library hast set the following property:

    target_compile_features(mylib INTERFACE cxx_std_17)

Now I try to add otherlib to mylib (INTERFACE as well). otherlib has set
some c++11 compile_features.

When I try to compile tests for my lib I see gnu++11 as requested
standard. Without otherlib gnu++17 is selected.

Could this be a bug or I am using CMake in a wrong way. What is the best
way to set the required standard for a header-only library?

Thank You

Jan


https://travis-ci.org/ObiWahn/libobi/builds/297542567
https://github.com/ObiWahn/libobi/blob/cmake_problem/CMakeLists.txt#L31
- mylib
https://github.com/kvasir-io/mpl/blob/development/CMakeLists.txt#L11 -
otherlib
--

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
Reply | Threaded
Open this post in threaded view
|

Re: [CMAKE] target_compile_features question

Jan Christoph Uhde
Sorry for the noise!

I just noticed that I made a mistake in the shared lib version. I have
obviously to use PUBLIC instead of INTERFACE, when specifying compile
features.

Jan

On 2017-11-05 15:07, Jan Christoph Uhde wrote:

> Hi,
>
> I have a project using CMake 3.9.
> The project contains a header only library mylib.
> The library hast set the following property:
>
>     target_compile_features(mylib INTERFACE cxx_std_17)
>
> Now I try to add otherlib to mylib (INTERFACE as well). otherlib has set
> some c++11 compile_features.
>
> When I try to compile tests for my lib I see gnu++11 as requested
> standard. Without otherlib gnu++17 is selected.
>
> Could this be a bug or I am using CMake in a wrong way. What is the best
> way to set the required standard for a header-only library?
>
> Thank You
>
> Jan
>
>
> https://travis-ci.org/ObiWahn/libobi/builds/297542567
> https://github.com/ObiWahn/libobi/blob/cmake_problem/CMakeLists.txt#L31
> - mylib
> https://github.com/kvasir-io/mpl/blob/development/CMakeLists.txt#L11 -
> otherlib
>

--

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
Reply | Threaded
Open this post in threaded view
|

Re: target_compile_features question

Florian Lindner
In reply to this post by Jan Christoph Uhde


Am 05.11.2017 um 15:07 schrieb Jan Christoph Uhde:

> Hi,
>
> I have a project using CMake 3.9.
> The project contains a header only library mylib.
> The library hast set the following property:
>
>     target_compile_features(mylib INTERFACE cxx_std_17)
>
> Now I try to add otherlib to mylib (INTERFACE as well). otherlib has set
> some c++11 compile_features.
>
> When I try to compile tests for my lib I see gnu++11 as requested
> standard. Without otherlib gnu++17 is selected.

Hey,
just being curious, is cxx_std_17 a valid feature? I don't see it listed in https://cmake.org/cmake/help/v3.1/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.html

Best,
Florian
--

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
Reply | Threaded
Open this post in threaded view
|

Re: target_compile_features question

Lectem

Because you are looking at an old CMake version 😉

I think it was introduced in cmake 3.8.2 ?

 

De : [hidden email]
Envoyé le :dimanche 5 novembre 2017 17:03
À : [hidden email]
Objet :Re: [CMake] target_compile_features question

 

 

 

Am 05.11.2017 um 15:07 schrieb Jan Christoph Uhde:

> Hi,

>

> I have a project using CMake 3.9.

> The project contains a header only library mylib.

> The library hast set the following property:

>

>     target_compile_features(mylib INTERFACE cxx_std_17)

>

> Now I try to add otherlib to mylib (INTERFACE as well). otherlib has set

> some c++11 compile_features.

>

> When I try to compile tests for my lib I see gnu++11 as requested

> standard. Without otherlib gnu++17 is selected.

 

Hey,

just being curious, is cxx_std_17 a valid feature? I don't see it listed in https://cmake.org/cmake/help/v3.1/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.html

 

Best,

Florian

--

 

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

 


--

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