Skip to content

Commit 9d15770

Browse files
committed
install location: <prefix>/jsonfortran-<conpilerID>-<version>
e.g. /usr/local/jsonfortran-intel-1.0.0
1 parent ce47718 commit 9d15770

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

CMakeLists.txt

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ set ( VERSION_MINOR 0 )
3939
set ( VERSION_PATCH 0 )
4040
set ( VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" )
4141

42-
set ( PROJ_VERSION "${CMAKE_PROJECT_NAME}-${VERSION}" )
43-
4442
#-------------------------------------
4543
# Collect source files for the library
4644
#-------------------------------------
@@ -59,16 +57,19 @@ set ( CMAKE_Fortran_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/lib" )
5957
# versions compiled with different compilers can be installed in parallel
6058
string ( TOLOWER ${CMAKE_PROJECT_NAME}-${CMAKE_Fortran_COMPILER_ID} PACKAGE_NAME )
6159
string ( TOLOWER ${CMAKE_Fortran_COMPILER_ID}-compiler FCOMPILER_DIR )
60+
set ( PACKAGE_VERSION "${PACKAGE_NAME}-${VERSION}" )
61+
6262

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}" )
63+
# Most of this could be 'wrong' for Windows/Cygwin
64+
65+
set ( INSTALL_MOD_DIR "${PACKAGE_VERSION}/lib" )
66+
set ( INSTALL_LIB_DIR "${INSTALL_MOD_DIR}" )
7067
set( ABS_LIB_INSTALL_DIR "\${CMAKE_INSTALL_PREFIX}/${INSTALL_LIB_DIR}" )
7168

69+
# Put package export CMake files where they can be found
70+
# use `find_package ( jsonfortran-${CMAKE_Fortran_COMPILER_ID} <version> REQUIRED )`
71+
set ( EXPORT_INSTALL_DIR "${PACKAGE_VERSION}/cmake" )
72+
7273
if ( "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin" )
7374
set ( ENABLE_DYLIBS_USE_RPATH TRUE CACHE BOOL
7475
"Enable @rpath install name for dylibs" )
@@ -115,7 +116,7 @@ install ( TARGETS ${LIB_NAME} ${LIB_NAME}-static
115116
LIBRARY DESTINATION "${INSTALL_LIB_DIR}"
116117
ARCHIVE DESTINATION "${INSTALL_LIB_DIR}" )
117118

118-
# Code to fix the install name.
119+
# Code to fix the dylib install name on Mac.
119120
include ( cmake/fixupInstallNameDir.cmake )
120121

121122
install ( DIRECTORY "${CMAKE_Fortran_MODULE_DIRECTORY}/" DESTINATION "${INSTALL_MOD_DIR}" )
@@ -133,8 +134,6 @@ add_custom_target ( uninstall
133134
#-----------------------------------------------------
134135
# Publicize installed location to other CMake projects
135136
#-----------------------------------------------------
136-
set ( EXPORT_INSTALL_DIR
137-
"${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PACKAGE_NAME}-${VERSION}" )
138137
install ( EXPORT ${PACKAGE_NAME}-targets DESTINATION "${EXPORT_INSTALL_DIR}" )
139138

140139
include ( CMakePackageConfigHelpers ) # Standard CMake module

0 commit comments

Comments
 (0)