Hi,
I am new to CMake although I have been aware of its existence for several years.
I am trying to use CMake to build a static library project in Visual Studio Community 2015. I have to pass compiler flag /fpconstant. Here is how I have prepared my CMakeLists.txt:
cmake_minimum_required(VERSION 3.19.4 FATAL_ERROR)
set(ENV{FC} "C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_2016.2.180/windows/bin/ia32/ifort.exe")
project(plybck LANGUAGES Fortran)
add_compile_options(/fpconstant)
add_library("${PROJECT_NAME}" STATIC plybckutils.f90)
However, after the project is built by CMake and I open the sln solution in Visual Studio, the flag has not changed (Fortran>Floating Point > Extend Precision of Single-Precision Constants).
I opened .vfproj in a text editor and verified that /fpconstant is in the string AdditionalOptions, so it seems like the add_compile_options is doing its job.
Then, I manually changed the flag in Visual Studio GUI to /fpconstant, and saved the project. I can see that ExtendSinglePrecisionConstants=“true” has been subsequently added to .vfproj which was not there before.
How can I change get CMake to do this change for me?