diff --git a/CMakeLists.txt b/CMakeLists.txt index 292a32b9..86784bf3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,30 +28,33 @@ if(NOT MSVC) set(CMAKE_OSX_ARCHITECTURES "arm64" CACHE STRING "The OSX architecture") endif() else() - message(${ColorRed}"cmake not configured for windows!") - return() - # Need to set up external link to lapack (preferrably a tagged relase, ex. v3.12.0): - # git clone https://github.com/Reference-LAPACK/lapack.git - # git checkout v3.12.0 # Build using: cmake --build . --config Release - set(tp_flags_common "/nologo /fpp /fpe:0 /names:lowercase /assume:underscore /real-size:64 /fp:precise /extend-source:132 /iface:cref") + set(tp_flags_common "/nologo /fpp /fpe:0 /names:lowercase /assume:underscore /fp:precise /extend-source:132 /iface:cref") set(tp_optim_flags "${tp_flags_common}") - set(tp_debug_flags "${tp_flags_common} /check:bounds /warn:all,noexternal /traceback /check:all,noarg_temp_created,nopointers") + set(tp_debug_flags "${tp_flags_common} /check:bounds /traceback") endif() -if(CMAKE_BUILD_TYPE MATCHES Debug) - set(tp_fortran_flags ${tp_debug_flags}) -else() - set(CMAKE_BUILD_TYPE "Release") - message(STATUS "CMAKE_BUILD_TYPE not specified, defaulting to Release.") - set(tp_fortran_flags ${tp_optim_flags}) +# Check if the build type is not set and set it to Release +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE) endif() # Set FORTRAN compile flags for thermopack and lapack -set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${tp_fortran_flags}") +set(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} ${tp_optim_flags}") +set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} ${tp_debug_flags}") if(MSVC) + if(POLICY CMP0077) + set(CMAKE_POLICY_DEFAULT_CMP0077 NEW) + endif() + # Disable single/complex/complex16 as it is not used by thermopack + set(BUILD_SINGLE OFF) + set(BUILD_COMPLEX OFF) + set(BUILD_COMPLEX16 OFF) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/external/lapack) + # Add flags not comatible with lapack + set(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} /real-size:64 ") + set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} /real-size:64 /warn:all,noexternal /check:all,noarg_temp_created,nopointers") endif(MSVC) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src "thermopack")