@@ -34,7 +34,7 @@ project ( jsonfortran NONE )
34
34
# C.F. semver.org
35
35
#----------------------------------
36
36
set ( VERSION_MAJOR 4 )
37
- set ( VERSION_MINOR 0 )
37
+ set ( VERSION_MINOR 1 )
38
38
set ( VERSION_PATCH 0 )
39
39
set ( VERSION "${VERSION_MAJOR} .${VERSION_MINOR} .${VERSION_PATCH} " )
40
40
@@ -49,27 +49,40 @@ set ( JF_TEST_UCS4_SUPPORT_SRC "${CMAKE_SOURCE_DIR}/src/tests/introspection/test
49
49
# Collect all the mod files into their own
50
50
# directory to ease installation issues
51
51
#-----------------------------------------
52
- set ( MODULE_DIR "${CMAKE_BINARY_DIR} /lib " )
52
+ set ( MODULE_DIR "${CMAKE_BINARY_DIR} /include " )
53
53
54
54
#-------------------------------------
55
55
# Define where our files get installed
56
56
#-------------------------------------
57
+ set ( USE_GNU_INSTALL_CONVENTION FALSE
58
+ CACHE BOOL
59
+ "Install library, module file and documentation to standard GNU locations. Do not use this if supporting multiple Fortran compilers" )
60
+
57
61
# Set the package name to be specific to the compiler used, so that
58
62
# versions compiled with different compilers can be installed in parallel
59
63
string ( TOLOWER ${CMAKE_PROJECT_NAME} -${CMAKE_Fortran_COMPILER_ID} PACKAGE_NAME )
60
- string ( TOLOWER ${CMAKE_Fortran_COMPILER_ID} -compiler FCOMPILER_DIR )
61
64
set ( PACKAGE_VERSION "${PACKAGE_NAME} -${VERSION} " )
62
65
66
+ if (USE_GNU_INSTALL_CONVENTION)
67
+ include (GNUInstallDirs)
68
+ set ( INSTALL_MOD_DIR "${CMAKE_INSTALL_INCLUDEDIR} " )
69
+ set ( INSTALL_LIB_DIR "${CMAKE_INSTALL_LIBDIR} " )
70
+ set ( ABS_LIB_INSTALL_DIR "\$ {CMAKE_INSTALL_FULL_LIBDIR}" )
71
+ else ()
72
+ # Most of this could be 'wrong' for Windows/Cygwin
73
+ set ( INSTALL_MOD_DIR "${PACKAGE_VERSION} /lib" )
74
+ set ( INSTALL_LIB_DIR "${INSTALL_MOD_DIR} " )
75
+ set ( ABS_LIB_INSTALL_DIR "\$ {CMAKE_INSTALL_PREFIX}/${INSTALL_LIB_DIR} " )
76
+ endif ()
63
77
64
- # Most of this could be 'wrong' for Windows/Cygwin
65
-
66
- set ( INSTALL_MOD_DIR "${PACKAGE_VERSION} /lib" )
67
- set ( INSTALL_LIB_DIR "${INSTALL_MOD_DIR} " )
68
- set ( ABS_LIB_INSTALL_DIR "\$ {CMAKE_INSTALL_PREFIX}/${INSTALL_LIB_DIR} " )
69
78
70
79
# Put package export CMake files where they can be found
71
80
# use `find_package ( jsonfortran-${CMAKE_Fortran_COMPILER_ID} <version> REQUIRED )`
72
- set ( EXPORT_INSTALL_DIR "${PACKAGE_VERSION} /cmake" )
81
+ if (USE_GNU_INSTALL_CONVENTION)
82
+ set ( EXPORT_INSTALL_DIR "${INSTALL_LIB_DIR} /cmake/${PACKAGE_VERSION} " )
83
+ else ()
84
+ set ( EXPORT_INSTALL_DIR "${PACKAGE_VERSION} /cmake" )
85
+ endif ()
73
86
74
87
if ( "${CMAKE_SYSTEM_NAME} " MATCHES "Darwin" )
75
88
set ( ENABLE_DYLIBS_USE_RPATH TRUE CACHE BOOL
@@ -157,6 +170,15 @@ if ( NOT SKIP_DOC_GEN )
157
170
COMMENT "Building HTML documentation for ${CMAKE_PROJECT_NAME} using ROBODoc" )
158
171
add_custom_target ( documentation ALL
159
172
DEPENDS ${ROBODOC_OUTPUTS} )
173
+ set ( INSTALL_API_DOCUMENTATION TRUE
174
+ CACHE BOOL "Install ROBODoc generated documentation?" )
175
+ if ( INSTALL_API_DOCUMENTATION )
176
+ if ( USE_GNU_INSTALL_CONVENTION )
177
+ install ( DIRECTORY "${DOC_DIR} /" DESTINATION "${CMAKE_INSTALL_DOCDIR} " )
178
+ else ()
179
+ install ( DIRECTORY "${DOC_DIR} /" DESTINATION "${CMAKE_INSTALL_PREFIX} /${PACKAGE_VERSION} /doc" )
180
+ endif ()
181
+ endif ()
160
182
else () # Not found
161
183
message ( WARNING
162
184
"ROBODoc not found! Please set the CMake cache variable ROBODOC to point to the installed ROBODoc binary, and reconfigure or disable building the documentation. ROBODoc can be installed from: http://www.xs4all.nl/~rfsber/Robo/ If you do not wish to install ROBODoc and build the json-fortran documentation, then please set the CMake cache variable SKIP_DOC_GEN to TRUE." )
0 commit comments