Skip to content

Commit 1955920

Browse files
Tom CluneTom Clune
authored andcommitted
Improved cmake usage.
1) Can now build in standalone. Logic must be retested in a nested fixture before this can go to master. 2) Should now do a proper cmake install.
1 parent 1dc23a7 commit 1955920

4 files changed

Lines changed: 37 additions & 5 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/@cmake
2+
/Externals.cfg~

CMakeLists.txt

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,30 @@
1-
cmake_policy (SET CMP0048 NEW) # VERSION in project()
1+
cmake_minimum_required (VERSION 3.13)
2+
cmake_policy (SET CMP0053 NEW)
3+
cmake_policy (SET CMP0054 NEW)
24

35
project (
46
MAPL
57
VERSION 1.1
68
LANGUAGES Fortran CXX C) # Note - CXX is required for ESMF
79

10+
if (NOT COMMAND esma) # build as standalone project
11+
# Invoke checkout_ externals, but only the first time we
12+
# configure.
13+
if (NOT SKIP_MANAGE_EXTERNALS)
14+
execute_process (
15+
COMMAND "checkout_externals"
16+
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
17+
)
18+
endif ()
19+
set(SKIP_MANAGE_EXTERNALS ON CACHE BOOL "Set to skip manage externals step")
20+
21+
list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/@cmake")
22+
include (esma)
23+
endif()
24+
25+
ecbuild_declare_project()
26+
27+
828
# Special case - MAPL_cfio is built twice with two different precisions.
929
add_subdirectory (MAPL_cfio MAPL_cfio_r4)
1030
add_subdirectory (MAPL_cfio MAPL_cfio_r8)
@@ -13,6 +33,7 @@ add_subdirectory (GMAO_pFIO)
1333
add_subdirectory (MAPL_Base)
1434

1535
# Git transition defect:
16-
# Uncomment the line below once the dev branch of MAPL has been brough it.
36+
# Uncomment the line below once the dev branch of MAPL has been brought in.
1737
#add_subdirectory (Tests)
1838

39+
ecbuild_install_project (NAME MAPL)

Externals.cfg

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[GEOS_cmake]
2+
required = True
3+
repo_url = git@github.com:GEOS-ESM/ESMA_cmake.git
4+
local_path = ./@cmake
5+
tag = v1.0.2
6+
externals = Externals.cfg
7+
protocol = git
8+
9+
[externals_description]
10+
schema_version = 1.0.0
11+

MAPL_cfio/CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,13 @@ endif ()
2525

2626
set (EOS )
2727

28-
include_directories (${INC_NETCDF})
29-
include_directories (${INC_ESMF})
30-
3128
set (lib MAPL_cfio_${precision})
3229

3330
esma_add_library (${lib}
3431
SRCS ${srcs}
3532
DEPENDENCIES ${ESMF_LIBRARIES}
3633
)
34+
target_include_directories (${lib} PUBLIC ${INC_NETCDF} ${INC_ESMF})
3735

3836
if (precision MATCHES "r8")
3937
string (REPLACE " " ";" flags ${FREAL8})

0 commit comments

Comments
 (0)