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}") message("C++${std} ext flags: ${CMAKE_CXX${std}_EXTENSION_COMPILE_OPTION}") endforeach() Wll generate for GCC on Linux: -- The CXX compiler identification is GNU 8.1.1 -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done C++98 std flags: -std=c++98 C++98 ext flags: -std=gnu++98 C++11 std flags: -std=c++11 C++11 ext flags: -std=gnu++11 C++14 std flags: -std=c++14 C++14 ext flags: -std=gnu++14 C++17 std flags: -std=c++1z C++17 ext flags: -std=gnu++1z -- Configuring done PGI on Linux: -- The CXX compiler identification is PGI 18.4.0 -- Check for working CXX compiler: /opt/pgi/linux86-64/18.4/bin/pgc++ -- Check for working CXX compiler: /opt/pgi/linux86-64/18.4/bin/pgc++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done C++98 std flags: -A C++98 ext flags: --gnu_extensions C++11 std flags: --c++11;-A C++11 ext flags: --c++11;--gnu_extensions C++14 std flags: --c++14;-A C++14 ext flags: --c++14;--gnu_extensions C++17 std flags: --c++17;-A C++17 ext flags: --c++17;--gnu_extensions -- Configuring done And for IBM XL on AIX: -- The CXX compiler identification is XL 13.1.3 -- Check for working CXX compiler: /usr/bin/xlC -- Check for working CXX compiler: /usr/bin/xlC -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done C++98 std flags: -qlanglvl=strict98 C++98 ext flags: -qlanglvl=extended C++11 std flags: -qlanglvl=extended0x C++11 ext flags: -qlanglvl=extended0x C++14 std flags: C++14 ext flags: C++17 std flags: C++17 ext flags: -- Configuring done -- Generating done - Chuck
-- 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: https://cmake.org/mailman/listinfo/cmake