From bc74f99a07f3419b0cdd6d4c06a7f64278d435cd Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Fri, 23 Jul 2021 13:36:12 -0600 Subject: [PATCH 1/2] Rename cmake target ccpp to ccpp_framework, cleanup various CMakeLists.txt --- CMakeLists.txt | 4 ++-- src/CMakeLists.txt | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aa9252ef..e5719865 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ endif (NOT PROJECT) #------------------------------------------------------------------------------ cmake_minimum_required(VERSION 3.0) -project(ccpp +project(ccpp_framework VERSION 4.0.0 LANGUAGES C CXX Fortran) @@ -98,7 +98,7 @@ add_subdirectory(doc) #------------------------------------------------------------------------------ # Configure and enable packaging set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Common Community Physics Package - Framework") -set(CPACK_PACKAGE_VENDOR "GMTB NOAA/NCAR") +set(CPACK_PACKAGE_VENDOR "DTC NOAA/NCAR") set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md") set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 57944670..d679fd4d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -58,9 +58,9 @@ set(${PACKAGE}_LIB_DIRS #------------------------------------------------------------------------------ # Define the executable and what to link -add_library(ccpp STATIC ${SOURCES_F90}) -target_link_libraries(ccpp LINK_PUBLIC ${LIBS} ${CMAKE_DL_LIBS}) -set_target_properties(ccpp PROPERTIES VERSION ${PROJECT_VERSION} +add_library(ccpp_framework STATIC ${SOURCES_F90}) +target_link_libraries(ccpp_framework LINK_PUBLIC ${LIBS} ${CMAKE_DL_LIBS}) +set_target_properties(ccpp_framework PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR} LINK_FLAGS ${CMAKE_Fortran_FLAGS}) @@ -68,28 +68,28 @@ set_target_properties(ccpp PROPERTIES VERSION ${PROJECT_VERSION} # Installation # if (PROJECT STREQUAL "CCPP-FV3") - target_include_directories(ccpp PUBLIC + target_include_directories(ccpp_framework PUBLIC $ $ ) elseif (PROJECT STREQUAL "CCPP-SCM") - target_include_directories(ccpp PUBLIC + target_include_directories(ccpp_framework PUBLIC $ $ ) endif (PROJECT STREQUAL "CCPP-FV3") # Define where to install the library -install(TARGETS ccpp - EXPORT ccpp-targets +install(TARGETS ccpp_framework + EXPORT ccpp_framework-targets ARCHIVE DESTINATION lib LIBRARY DESTINATION lib RUNTIME DESTINATION lib ) # Export our configuration -install(EXPORT ccpp-targets - FILE ccpp-config.cmake +install(EXPORT ccpp_framework-targets + FILE ccpp_framework-config.cmake DESTINATION lib/cmake ) From b89b0afe93be2354b7229a712aa7ba6d16f75899 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Fri, 23 Jul 2021 14:51:12 -0600 Subject: [PATCH 2/2] More cleanup in various CMakeLists.txt files --- CMakeLists.txt | 32 ++++---------------------------- src/CMakeLists.txt | 4 ++-- 2 files changed, 6 insertions(+), 30 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e5719865..1f908916 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,8 +8,8 @@ endif (NOT PROJECT) cmake_minimum_required(VERSION 3.0) project(ccpp_framework - VERSION 4.0.0 - LANGUAGES C CXX Fortran) + VERSION 5.0.0 + LANGUAGES Fortran) # Use rpaths on MacOSX set(CMAKE_MACOSX_RPATH 1) @@ -33,27 +33,12 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") if (OPENMP) include(detect_openmp) detect_openmp() - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${OpenMP_Fortran_FLAGS}") - message(STATUS "Enable OpenMP support for C/C++/Fortran compiler") + message(STATUS "Enable OpenMP support") else (OPENMP) - message (STATUS "Disable OpenMP support for C/C++/Fortran compiler") + message (STATUS "Disable OpenMP support") endif (OPENMP) -#------------------------------------------------------------------------------ -# The Fortran compiler/linker flag inserted by cmake to create shared libraries -# with the Intel compiler is deprecated (-i_dynamic), correct here. -# CMAKE_Fortran_COMPILER_ID = {"Intel", "PGI", "GNU", "Clang", "MSVC", ...} -if ("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "Intel") - string(REPLACE "-i_dynamic" "-shared-intel" - CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS - "${CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS}") - string(REPLACE "-i_dynamic" "-shared-intel" - CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS - "${CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS}") -endif() - #------------------------------------------------------------------------------ # Set a default build type if none was specified if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) @@ -64,15 +49,6 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "Coverage") endif() -#------------------------------------------------------------------------------ -# The PGI compiler can not find any cap routines in their library. -# This is due to how it labels subroutines within a modules. -# For example the subroutine b() in the moduel a(), gets named a_b. -# GCC and Intel do NOT do this, it is name simply as b. -if ("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "PGI") - message(STATUS "WARNING: PGI compiler is not fully ISO_C compliant; working solution involves a hack pgifix.py") -endif() - #------------------------------------------------------------------------------ # Request a static build option(BUILD_SHARED_LIBS "Build a static library" OFF) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d679fd4d..b09f5fc7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -69,12 +69,12 @@ set_target_properties(ccpp_framework PROPERTIES VERSION ${PROJECT_VERSION} # if (PROJECT STREQUAL "CCPP-FV3") target_include_directories(ccpp_framework PUBLIC - $ + $ $ ) elseif (PROJECT STREQUAL "CCPP-SCM") target_include_directories(ccpp_framework PUBLIC - $ + $ $ ) endif (PROJECT STREQUAL "CCPP-FV3")