夏青虫

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 :: 管理 ::
 You are only adding it to the main target.. I didn't realize. Add it to the mod target as well:
set_target_properties(main mod PROPERTIES COMPILE_FLAGS "-fpp")
Second option is to name the files .F90 instead of .f90, which will automatically trigger precompilation.
 
Third option is to just add -fpp flag globally to cmake flags:
set(CMAKE_Fortran_COMPILE_FLAGS ${CMAKE_Fortran_COMPILE_FLAGS} -fpp)
 

cmake_minimum_required(VERSION 2.6)
project(test Fortran)
option(DEFINE_MORE "If set to ON, -DMORE will be defined" OFF)
option(DEFINE_LESS OFF)
set(FORTRAN_PREPROCESS_FLAG "-fpp")

# force gfortran to preprocess the input files
# change this to "-fpp" for ifort (that's the ones i know...)

#if(DEFINE_MORE)
  add_definitions(-DMORE -DLESS)
#endif(DEFINE_MORE)

add_executable(test test.f90)
set_target_properties(test PROPERTIES COMPILE_FLAGS "${FORTRAN_PREPROCESS_FLAG}")
posted on 2013-01-21 10:43  夏青虫  阅读(678)  评论(0)    收藏  举报