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