#Create variable SRCFiles containing a list of all code files in this directory
file(GLOB SRCFiles *.f)




set(COLDAE_USE_OPENMP "OFF" CACHE TYPE BOOL)

if(COLDAE_USE_OPENMP) #Only need to check if we want to use it
  find_package(OpenMP)
  if(OPENMP_FOUND)
    set (CMAKE_Fortran_FLAGS ${OpenMP_C_FLAGS})
    set (FFLAGS ${OpenMP_C_FLAGS})
    set (LDFLAGS ${OpenMP_C_FLAGS})
  else()
    MESSAGE(FATAL_ERROR 
                "\n"
                "=======================================================\n"
                "\n"
                " ERROR: Your compiler does not appear to support       \n"
                "        OpenMP. Check that your compiler supports and  \n"
                "        is compiled correctly. You can turn OpenMP off \n"
                "        by setting the CMake variable as follows:      \n"
                "            -DCOLDAE_USE_OPENMP=OFF                           \n"
                "        Or if you are using the OpenFCST shell script  \n"
                "        then DO NOT specify the flag:                  \n"
                "            --with-openmp                              \n"
                "\n"
                "=======================================================\n"
                "\n"

                )
  endif()
endif()






#Add library and make shared
add_library(${PROJECT_NAME} SHARED ${SRCFiles})

#Installation of the program
INSTALL(TARGETS ${PROJECT_NAME}
         DESTINATION lib
         PERMISSIONS OWNER_READ GROUP_READ WORLD_READ)