cmake_minimum_required(VERSION 2.6) enable_language (Fortran) project(packmol) # Build for release or debug purposes? SET(CMAKE_BUILD_TYPE release) #SET(CMAKE_BUILD_TYPE debug) # Default flags for release and debug set(CMAKE_Fortran_FLAGS_RELEASE "-Wall -O2") set(CMAKE_Fortran_FLAGS_DEBUG "-Werror -g -O2") # Common sources SET(srcall cenmass.f gencan.f initial.f io.f fgcommon.f packmolnew.f polartocart.f heuristics.f) # Common headers SET(headers sizes.i gencan.i molpa.i) # Serial-only sources SET(srcserial feasy.f geasy.f) # Parallel-only sources SET(srcparallel feasyparallel.f geasyparallel.f compindexes.f) # Compile SMP version? # Find_package doesn't currently support Fortran, so we need to do things by hand. #find_package( OpenMP ) option(USE_OPENMP "Compile OpenMP enabled version?" OFF) if(USE_OPENMP) # Determine necessary flags if(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fopenmp") elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "Intel") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -openmp") else(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") message(SEND_ERROR "Makefile does not support the chosen Fortran compiler \"${CMAKE_Fortran_COMPILER_NAME}\" using OpenMP.") endif(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") # Compile add_executable(ppackmol ${srcall} ${srcparallel}) else(USE_OPENMP) # Build the serial executable. add_executable(packmol ${srcall} ${srcserial}) endif(USE_OPENMP)