Re: [CMake] Is there a way to obtain the current compiler standard flag?

2018-06-01 Thread Craig Scott
On Sat, Jun 2, 2018 at 6:32 AM, Chris Green wrote: > Ack! Apparently even the hard way won't work, because apparently one > cannot nest $ > set(CXX_STD_FLAG "$,\ > $>,${CMAKE_CXX11_EXTENSION_COMPILE_OPTION},\ > $>,${CMAKE_CXX14_EXTENSION_COMPILE_OPTION},\ >

Re: [CMake] Is there a way to obtain the current compiler standard flag?

2018-06-01 Thread Chris Green
Ack! Apparently even the hard way won't work, because apparently one cannot nest $ set(CXX_STD_FLAG "$,\ $>,${CMAKE_CXX11_EXTENSION_COMPILE_OPTION},\ $>,${CMAKE_CXX14_EXTENSION_COMPILE_OPTION},\ $>,${CMAKE_CXX17_EXTENSION_COMPILE_OPTION},\ $>,${CMAKE_CXX20_EXTENSION_COMPILE_OPTION},\

Re: [CMake] Is there a way to obtain the current compiler standard flag?

2018-06-01 Thread Chris Green
Hi, I was hoping this would work: $,${CMAKE_CXX$_EXTENSION_COMPILE_OPTION},${CMAKE_CXX$_STANDARD_COMPILE_OPTION}> But apparently it's not legal to calculate a variable name based on a generator expression. Is there some elegant way to get want I want here or do I have to check specifically

Re: [CMake] Is there a way to obtain the current compiler standard flag?

2018-06-01 Thread Chris Green
Hi, I'll give this a shot, thank you. Ideally we'd have a generator expression pick up ${std} from the relevant target property, but I'll have to play with that since I'm not familiar enough with generator expressions to know /a priori/ how this will turn out. Thanks for your help, Chris.

Re: [CMake] Is there a way to obtain the current compiler standard flag?

2018-05-30 Thread Chuck Atkins
Hi Chris. Try using the the CMAKE_CXX${std}_STANDARD_COMPILE_OPTION variable. For example, the folowing piece of CMake code: cmake_minimum_required(VERSION 3.9) project(foo CXX) foreach(std IN ITEMS 98 11 14 17) message("C++${std} std flags: ${CMAKE_CXX${std}_STANDARD_COMPILE_OPTION}")

Re: [CMake] Is there a way to obtain the current compiler standard flag?

2018-05-30 Thread Robert Maynard
I am pretty sure you currently can't extract the compile flag information. This would be an enhancement and would have to be done as a generator expression. On Tue, May 29, 2018 at 5:37 PM Chris Green wrote: > Hi, > We have to use a utility (Root's rootcling/genreflex tool) as part of a >

[CMake] Is there a way to obtain the current compiler standard flag?

2018-05-29 Thread Chris Green
Hi, We have to use a utility (Root's rootcling/genreflex tool) as part of a custom command to parse some C++ headers. We are in the process of migrating from using raw -std= additions to compilation flags to use of CMAKE_CXX_STANDARD and friends. We need to pass the correct compiler flag to