cmake_minimum_required (VERSION 2.6) # set (CMAKE_VERBOSE_MAKEFILE ON) # include(CMakeForceCompiler) # CMAKE_FORCE_Fortran_COMPILER(/opt/intel/composer_xe_2013_sp1.5.212/bin/intel64/ifort "Intel Fortran Compiler") # set(FC /opt/intel/composer_xe_2013_sp1.5.212/bin/intel64/ifort) # set(CMAKE_FORTRAN_LINK_EXECUTABLE /opt/intel/composer_xe_2013_sp1.5.212/bin/intel64/ifort) enable_language (CXX Fortran) project (epx) # Turn on the ability to create folders to organize projects (.vcproj) # It creates "CMakePredefinedTargets" folder by default and adds CMake # defined projects like INSTALL.vcproj and ZERO_CHECK.vcproj set_property(GLOBAL PROPERTY USE_FOLDERS ON) # Set compiler flags and options. # Here it is setting the Visual Studio warning level to 4 # set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") # Command to output information to the console # Useful for displaying errors, warnings, and debugging # message ("cxx Flags: " ${CMAKE_CXX_FLAGS}) # FFLAGS depend on the compiler get_filename_component (Fortran_COMPILER_NAME ${CMAKE_Fortran_COMPILER} NAME) message ("Fortran Compiler: " ${Fortran_COMPILER_NAME}) if (Fortran_COMPILER_NAME MATCHES "gfortran.*") # gfortran set (CMAKE_Fortran_FLAGS_RELEASE "-funroll-all-loops -fno-f2c -O3") set (CMAKE_Fortran_FLAGS_DEBUG "-fno-f2c -O0 -g") elseif (Fortran_COMPILER_NAME MATCHES "ifort.*") # ifort set (CMAKE_Fortran_FLAGS_RELEASE "-O3 -traceback -fpp -LIBS:static -nodebug -stand:f90") set (CMAKE_Fortran_FLAGS_DEBUG "-Od -traceback -fpp -LIBS:static -c -debug:full -debug-parameters:all") elseif (Fortran_COMPILER_NAME MATCHES "g77") # g77 set (CMAKE_Fortran_FLAGS_RELEASE "-funroll-all-loops -fno-f2c -O3 -m32") set (CMAKE_Fortran_FLAGS_DEBUG "-fno-f2c -O0 -g -m32") else (Fortran_COMPILER_NAME MATCHES "gfortran.*") message ("Fortran compiler: " ${Fortran_COMPILER_NAME}) message ("No optimized Fortran compiler flags are known, we just try -O2...") set (CMAKE_Fortran_FLAGS_RELEASE "-O2") set (CMAKE_Fortran_FLAGS_DEBUG "-O0 -g") endif (Fortran_COMPILER_NAME MATCHES "gfortran.*") if(MSVC) set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} -Qmkl:sequential") set (CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -Qmkl:sequential") ENDIF() message ("CMAKE_Fortran_COMPILER full path: " ${CMAKE_Fortran_COMPILER}) message ("CMAKE_Fortran_FLAGS_RELEASE: " ${CMAKE_Fortran_FLAGS_RELEASE}) message ("CMAKE_Fortran_FLAGS_DEBUG: " ${CMAKE_Fortran_FLAGS_DEBUG}) # Sub-directories where more CMakeLists.txt exist add_subdirectory (source) add_subdirectory (cpp) add_dependencies(epx epx_cxx) set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT epx) # SET_TARGET_PROPERTIES(epx PROPERTIES LINKER_LANGUAGE FORTRAN) # SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) # Adds logic to INSTALL.vcproj to copy epx.exe to destination directory # install (TARGETS epx RUNTIME DESTINATION ${PROJECT_SOURCE_DIR}/_install)