@@ -50,31 +50,24 @@ set ( JF_LIB_SRCS src/json_module.f90 )
50
50
# Collect all the mod files into their own
51
51
# directory to ease installation issues
52
52
#-----------------------------------------
53
- # No standard mechanism or location for compiled .mod files
54
- # but often they are thought of as similar to precompiled
55
- # header files. Let's include the compiler ID to ease
56
- # compatibility issues for thos linking against the installed
57
- # libraries.
58
- set ( CMAKE_Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR} /include" )
53
+ set ( CMAKE_Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR} /lib" )
59
54
60
55
#-------------------------------------
61
56
# Define where our files get installed
62
57
#-------------------------------------
63
- # Most of this is probably 'wrong' for Windows/Cygwin
64
-
65
- #if ( ${CMAKE_SYSTEM_NAME} MATCHES "Linux" )
66
- # include ( GNUInstallDirs ) # Standard CMake module
67
- if ( UNIX ) #Apple, BSD, solaris, other *NIX? Framework on Apple instead?
68
- set ( CMAKE_INSTALL_LIBDIR lib )
69
- set ( CMAKE_INSTALL_INCLUDEDIR include )
70
- set ( CMAKE_INSTALL_DATAROOTDIR share )
71
- endif ( UNIX )
72
- #endif ( ${CMAKE_SYSTEM_NAME} MATCHES "Linux" )
73
-
74
58
# Set the package name to be specific to the compiler used, so that
75
59
# versions compiled with different compilers can be installed in parallel
76
60
string ( TOLOWER ${CMAKE_PROJECT_NAME} -${CMAKE_Fortran_COMPILER_ID} PACKAGE_NAME )
77
- string ( TOLOWER fortran/${CMAKE_Fortran_COMPILER_ID}-compiler FCOMPILER_DIR )
61
+ string ( TOLOWER ${CMAKE_Fortran_COMPILER_ID} -compiler FCOMPILER_DIR )
62
+
63
+ # Most of this is probably 'wrong' for Windows/Cygwin
64
+ # if ( UNIX )
65
+ set ( CMAKE_INSTALL_LIBDIR lib )
66
+ set ( CMAKE_INSTALL_DATAROOTDIR share )
67
+ # endif ( UNIX )
68
+ set ( INSTALL_MOD_DIR "${CMAKE_INSTALL_LIBDIR} /${PROJ_VERSION} /${FCOMPILER_DIR} " )
69
+ set ( INSTALL_LIB_DIR "${CMAKE_INSTALL_LIBDIR} /${PROJ_VERSION} /${FCOMPILER_DIR} " )
70
+ set ( ABS_LIB_INSTALL_DIR "\$ {CMAKE_INSTALL_PREFIX}/${INSTALL_LIB_DIR} " )
78
71
79
72
if ( "${CMAKE_SYSTEM_NAME} " MATCHES "Darwin" )
80
73
set ( ENABLE_DYLIBS_USE_RPATH TRUE CACHE BOOL
@@ -86,7 +79,7 @@ if ( ENABLE_DYLIBS_USE_RPATH )
86
79
set ( CMAKE_MACOSX_RPATH TRUE )
87
80
else ( ENABLE_DYLIBS_USE_RPATH )
88
81
set ( CMAKE_INSTALL_NAME_DIR
89
- "\$ {CMAKE_INSTALL_PREFIX}/ ${CMAKE_INSTALL_LIBDIR} / ${FCOMPILER_DIR } " )
82
+ "${ABS_LIB_INSTALL_DIR } " )
90
83
endif ( ENABLE_DYLIBS_USE_RPATH )
91
84
92
85
#---------------------------------------------
@@ -119,27 +112,24 @@ set_target_properties ( ${LIB_NAME}
119
112
120
113
install ( TARGETS ${LIB_NAME} ${LIB_NAME} -static
121
114
EXPORT ${PACKAGE_NAME} -targets
122
- LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR} / ${FCOMPILER_DIR } "
123
- ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR} / ${FCOMPILER_DIR } " )
124
- # ?ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}/${FCOMPILER_DIR}/${CMAKE_PROJECT_NAME}-${VERSION}"
115
+ LIBRARY DESTINATION "${INSTALL_LIB_DIR } "
116
+ ARCHIVE DESTINATION "${INSTALL_LIB_DIR } " )
117
+
125
118
126
- set ( ABS_LIB_INSTALL_DIR "\$ {CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} /${FCOMPILER_DIR} " )
127
119
if ( NOT ENABLE_DYLIBS_USE_RPATH )
128
120
if ( CMAKE_INSTALL_NAME_TOOL ) # On Mac and have install_name_tool
129
- install ( CODE "
130
- if ( DEFINED ENV{DESTDIR} )
121
+ install ( CODE
122
+ " if ( DEFINED ENV{DESTDIR} )
131
123
string ( REGEX REPLACE \" /$\" \"\" DESTDIR \"\$ ENV{DESTDIR}\" ) # strip trailing /
132
- get_filename_component ( INSALL_LIB
124
+ get_filename_component ( INSTALL_LIB
133
125
\$ {DESTDIR}/${ABS_LIB_INSTALL_DIR} /lib${LIB_NAME} .${VERSION_MAJOR} .${VERSION_MINOR} .dylib
134
126
ABSOLUTE )
135
127
execute_process ( COMMAND \" ${CMAKE_INSTALL_NAME_TOOL} \"
136
- -id \"\$ {INSALL_LIB }\" \"\$ {INSALL_LIB }\" )
128
+ -id \"\$ {INSTALL_LIB }\" \"\$ {INSTALL_LIB }\" )
137
129
endif ( DEFINED ENV{DESTDIR} )" )
138
130
endif ( CMAKE_INSTALL_NAME_TOOL )
139
131
endif ( NOT ENABLE_DYLIBS_USE_RPATH )
140
-
141
132
142
- set ( INSTALL_MOD_DIR "${CMAKE_INSTALL_INCLUDEDIR} /${FCOMPILER_DIR} /${PROJ_VERSION} " )
143
133
install ( DIRECTORY "${CMAKE_Fortran_MODULE_DIRECTORY} /" DESTINATION "${INSTALL_MOD_DIR} " )
144
134
145
135
#------------------------------------------
0 commit comments