Hi. There is certainly room for providing more, but BUILD_TYPE is not the only option settable in a compiler-agnostic way. There are target properties:
C_STANDARD CXX_STANDARD INCLUDE_DIRECTORIES INTERPROCEDURAL_OPTIMIZATION POSITION_INDEPENDENT_CODE WIN32_EXECUTABLE and maybe more (I do not claim the list above to be exhaustive). Petr On Wed, Feb 17, 2016 at 11:23 AM, Nagy-Egri Máté Ferenc <cmake@cmake.org> wrote: > Hi Jan, > > > > Unfortunately, I cannot help you in this regard, though I am surprised how > little attention this question gained. I too feel that CMake could do > better both in this regard. While ABI detection is very well done, > BUILD_TYPE seems to be the only compiler agnostic option available. I do > not know how to set warning levels for eg. in a compiler agnostic manner. > Aside from this, there are dozens of other options that are common to all > C++ compilers and it would rock if I need not look up the exact params for > all of them. > > > > Sorry I could not help, but I do feel the struggle. > > > > Cheers, > > Máté > > > > *Feladó: *🐋 Jan Hegewald <jan.hegew...@awi.de> > *Elküldve: *2016. február 5., péntek 11:36 > *Címzett: *cmake@cmake.org > *Tárgy: *[CMake] compiler independent compiler flags > > > > Dear all, > > do you know a best practice on how to specify compiler flags without > knowing in advance which compiler will be used? > > Its about Fortran projects, where I e.g. want to explicitly enable the > preprocessor, or make all default real values 8 byte wide. This could be > done as such: > > if(${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel") > > set(CMAKE_Fortran_FLAGS "-fpp -r8") > > elseif(${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU") > > set(CMAKE_Fortran_FLAGS "-cpp -fdefault-real-8") > > endif() > > > > Cmake has the cmake-compile-features and I though maybe some similar > mechanism exists for above mentioned compiler switches. So I could say > > target_compile_features(mylib PRIVATE f_preprocessor f_real_8) > > > > Thanks for sharing your advise, > > Jan > > > > > > -- > > > > 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 >
-- 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