简体   繁体   中英

How to disable Fortran option -DNDEBUG in cmake when i set -DCMAKE_BUILD_TYPE=Release?

I had subroutine that had NDEBUG in variables using Intel Fortran compiler. If I use cmake for Release -DCMAKE_BUILD_TYPE=Release automatically gave error since it var will change value of 1.

error #5082: Syntax error, found INTEGER_CONSTANT '1' when expecting one of: %FILL <IDENTIFIER>
      INTEGER(LONG), PARAMETER        :: 1        =  250   ! Size of DEBUG array
-----------------------------------------^

it was

     INTEGER(LONG), PARAMETER        :: NDEBUG        =  250

Any clue?

Got it.

in Cmakelists.txt, removing /DNDEBUG in CMAKE_Fortran_FLAGS_RELEASE_INIT any any release. as can be see in the intel.cmake

if (${__WINDOWS_INTEL} MATCHES 1)
set(CMAKE_Fortran_FLAGS_MINSIZEREL "/O1")
set(CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "/O1")
set(CMAKE_Fortran_FLAGS_RELEASE "/O2")
set(CMAKE_Fortran_FLAGS_RELEASE_INIT "/O2")
set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "/O2 /debug:full")
set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "/O2 /debug:full")
set(CMAKE_CXX_FLAGS_RELEASE= /O3 /Ob2)
set(CMAKE_CXX_FLAGS_RELEASE_INIT= /O3 /Ob2)
endif()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM