1
1
# CMake Configuration and build added by Izaak Beekman -- May, 2014
2
- #
2
+
3
3
# Copy right (c) 2014, Izaak Beekman
4
4
# All rights reserved.
5
- #
5
+
6
6
# This file is contributed to the json-fortran project, and
7
7
# is licensed under the terms of json-fortran license. The json-fortran
8
8
# license is located in the LICENSE file which must be distributed with
@@ -82,11 +82,9 @@ if ( "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin" )
82
82
endif ( "${CMAKE_SYSTEM_NAME} " MATCHES "Darwin" )
83
83
84
84
if ( ENABLE_DYLIBS_USE_RPATH )
85
- if ( "${CMAKE_Fortran_COMPILER_ID} " MATCHES "Intel" )
86
- message ( WARNING
87
- "CMake bug may cause problems linking against dylibs compiled with ifort and installed using @rpath" )
88
- endif ( "${CMAKE_Fortran_COMPILER_ID} " MATCHES "Intel" )
89
- set ( CMAKE_MACOSX_RPATH FALSE )
85
+ message ( WARNING
86
+ "NOTICE: Currently CMake does not support installing @rpath install name dylibs using DESTDIR. If you would like to be able to install using 'DESTDIR=/install/path/root' set ENABLE_DYLIBS_USE_RPATH to FALSE." )
87
+ set ( CMAKE_MACOSX_RPATH TRUE )
90
88
else ( ENABLE_DYLIBS_USE_RPATH )
91
89
set ( CMAKE_INSTALL_NAME_DIR
92
90
"\$ {CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} /${FCOMPILER_DIR} " )
@@ -114,6 +112,7 @@ set_target_properties ( ${LIB_NAME}
114
112
#---------------------------------------------------------------------
115
113
# Add some tests to ensure that the software is performing as expected
116
114
#---------------------------------------------------------------------
115
+ # Not implemented yet
117
116
118
117
#-------------------------
119
118
# Perform the installation
@@ -125,27 +124,24 @@ install ( TARGETS ${LIB_NAME} ${LIB_NAME}-static
125
124
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR} /${FCOMPILER_DIR} " )
126
125
#?ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}/${FCOMPILER_DIR}/${CMAKE_PROJECT_NAME}-${VERSION}"
127
126
128
- # The following is some serious hackery and there's likely a better way
129
- # That better way is RPATH but bugs in CMake when using the Intel compiler persist
130
- # (-Wl,-rpath,/path/to/dylib does not get passed when compiling against imported dylib)
131
127
set ( ABS_LIB_INSTALL_DIR "\$ {CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} /${FCOMPILER_DIR} " )
132
128
if ( NOT ENABLE_DYLIBS_USE_RPATH )
133
129
if ( CMAKE_INSTALL_NAME_TOOL ) # On Mac and have install_name_tool
134
130
install ( CODE "
135
131
if ( DEFINED ENV{DESTDIR} )
136
132
string ( REGEX REPLACE \" /$\" \"\" DESTDIR \"\$ ENV{DESTDIR}\" ) # strip trailing /
137
- get_filename_component ( _install_path \$ {DESTDIR}/${ABS_LIB_INSTALL_DIR}
133
+ get_filename_component ( INSALL_LIB
134
+ \$ {DESTDIR}/${ABS_LIB_INSTALL_DIR} /lib${LIB_NAME} .${VERSION_MAJOR} .${VERSION_MINOR} .dylib
138
135
ABSOLUTE )
139
- execute_process ( COMMAND
140
- ${CMAKE_INSTALL_NAME_TOOL} -id \$ {_install_path} \$ {_install_path}/lib ${LIB_NAME} . ${VERSION} .dylib )
136
+ execute_process ( COMMAND \" ${CMAKE_INSTALL_NAME_TOOL} \"
137
+ -id \"\$ {INSALL_LIB} \" \"\$ {INSALL_LIB} \" )
141
138
endif ( DEFINED ENV{DESTDIR} )" )
142
139
endif ( CMAKE_INSTALL_NAME_TOOL )
143
140
endif ( NOT ENABLE_DYLIBS_USE_RPATH )
144
141
145
-
146
142
147
143
set ( INSTALL_MOD_DIR "${CMAKE_INSTALL_INCLUDEDIR} /${FCOMPILER_DIR} /${PROJ_VERSION} " )
148
- install ( DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} / DESTINATION "${INSTALL_MOD_DIR} " )
144
+ install ( DIRECTORY " ${CMAKE_Fortran_MODULE_DIRECTORY} /" DESTINATION "${INSTALL_MOD_DIR} " )
149
145
150
146
#------------------------------------------
151
147
# Add portable unistall command to makefile
@@ -155,17 +151,17 @@ configure_file ( "${CMAKE_SOURCE_DIR}/cmake/uninstall.cmake.in" "${CMAKE_BINARY_
155
151
@ONLY )
156
152
157
153
add_custom_target ( uninstall
158
- COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR} /uninstall.cmake )
154
+ COMMAND ${CMAKE_COMMAND} -P " ${CMAKE_BINARY_DIR} /uninstall.cmake" )
159
155
160
156
#-----------------------------------------------------
161
157
# Publicize installed location to other CMake projects
162
158
#-----------------------------------------------------
163
159
set ( EXPORT_INSTALL_DIR
164
- ${CMAKE_INSTALL_DATAROOTDIR} /cmake/${PACKAGE_NAME}-${VERSION} )
165
- install ( EXPORT ${PACKAGE_NAME} -targets DESTINATION ${EXPORT_INSTALL_DIR} )
160
+ " ${CMAKE_INSTALL_DATAROOTDIR} /cmake/${PACKAGE_NAME} -${VERSION} " )
161
+ install ( EXPORT ${PACKAGE_NAME} -targets DESTINATION " ${EXPORT_INSTALL_DIR} " )
166
162
167
163
include ( CMakePackageConfigHelpers ) # Standard CMake module
168
- write_basic_package_version_file ( ${CMAKE_BINARY_DIR} /${PACKAGE_NAME}-config-version.cmake
164
+ write_basic_package_version_file ( " ${CMAKE_BINARY_DIR} /${PACKAGE_NAME} -config-version.cmake"
169
165
VERSION ${VERSION}
170
166
COMPATIBILITY SameMajorVersion )
171
167
@@ -183,16 +179,16 @@ endif ( NOT (\"${CMAKE_Fortran_COMPILER_ID}\" MATCHES \"\${CMAKE_Fortran_COMPILE
183
179
184
180
# install package config file
185
181
configure_package_config_file (
186
- ${CMAKE_SOURCE_DIR} /cmake/pkg/${CMAKE_PROJECT_NAME}-config.cmake.in
187
- ${CMAKE_BINARY_DIR} /pkg/${PACKAGE_NAME}-config.cmake
188
- INSTALL_DESTINATION ${EXPORT_INSTALL_DIR}
182
+ " ${CMAKE_SOURCE_DIR} /cmake/pkg/${CMAKE_PROJECT_NAME} -config.cmake.in"
183
+ " ${CMAKE_BINARY_DIR} /pkg/${PACKAGE_NAME} -config.cmake"
184
+ INSTALL_DESTINATION " ${EXPORT_INSTALL_DIR} "
189
185
PATH_VARS EXPORT_INSTALL_DIR INSTALL_MOD_DIR )
190
186
191
187
# Install the config and version files so that we can find this project with others
192
188
install ( FILES
193
- ${CMAKE_BINARY_DIR} /pkg/${PACKAGE_NAME}-config.cmake
194
- ${CMAKE_BINARY_DIR} /${PACKAGE_NAME}-config-version.cmake
195
- DESTINATION ${EXPORT_INSTALL_DIR} )
189
+ " ${CMAKE_BINARY_DIR} /pkg/${PACKAGE_NAME} -config.cmake"
190
+ " ${CMAKE_BINARY_DIR} /${PACKAGE_NAME} -config-version.cmake"
191
+ DESTINATION " ${EXPORT_INSTALL_DIR} " )
196
192
197
193
#----------------------------------------------
198
194
# Make build tree targets accessible for import
@@ -201,12 +197,12 @@ export ( TARGETS ${LIB_NAME} ${LIB_NAME}-static FILE ${PACKAGE_NAME}-targets.cma
201
197
202
198
# build tree package config file, NOT installed
203
199
configure_file (
204
- ${CMAKE_SOURCE_DIR} /cmake/${CMAKE_PROJECT_NAME}-config.cmake.in
205
- ${CMAKE_BINARY_DIR} /${PACKAGE_NAME}-config.cmake
200
+ " ${CMAKE_SOURCE_DIR} /cmake/${CMAKE_PROJECT_NAME} -config.cmake.in"
201
+ " ${CMAKE_BINARY_DIR} /${PACKAGE_NAME} -config.cmake"
206
202
@ONLY )
207
203
208
- set ( ENABLE_BUILD_TREE_IN_REGISTRY FALSE CACHE BOOL
204
+ set ( ENABLE_BUILD_TREE_EXPORT FALSE CACHE BOOL
209
205
"Add the ${PACKAGE_NAME} build tree to the CMake package registry?" )
210
- if ( ENABLE_BUILD_TREE_IN_REGISTRY )
206
+ if ( ENABLE_BUILD_TREE_EXPORT )
211
207
export ( PACKAGE ${PACKAGE_NAME} )
212
- endif ( ENABLE_BUILD_TREE_IN_REGISTRY )
208
+ endif ( ENABLE_BUILD_TREE_EXPORT )
0 commit comments