@@ -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
0 commit comments