File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -177,6 +177,14 @@ if(JSON_FORTRAN_USE_OpenCoarrays)
177177 PRIVATE OpenCoarrays::caf_mpi_static)
178178endif ()
179179
180+ target_include_directories (${LIB_NAME}
181+ PUBLIC
182+ $<BUILD_INTERFACE:${MODULE_DIR} >
183+ $<INSTALL_INTERFACE:${INSTALL_MOD_DIR} >)
184+ target_include_directories (${LIB_NAME} -static
185+ PUBLIC
186+ $<BUILD_INTERFACE:${MODULE_DIR} >
187+ $<INSTALL_INTERFACE:${INSTALL_MOD_DIR} >)
180188set_target_properties ( ${LIB_NAME} -static
181189 PROPERTIES
182190 OUTPUT_NAME ${LIB_NAME}
@@ -438,7 +446,9 @@ add_custom_target ( uninstall
438446#-----------------------------------------------------
439447# Publicize installed location to other CMake projects
440448#-----------------------------------------------------
441- install ( EXPORT ${PACKAGE_NAME} -targets DESTINATION "${EXPORT_INSTALL_DIR} " )
449+ install ( EXPORT ${PACKAGE_NAME} -targets
450+ NAMESPACE ${PACKAGE_NAME} ::
451+ DESTINATION "${EXPORT_INSTALL_DIR} " )
442452
443453include ( CMakePackageConfigHelpers ) # Standard CMake module
444454write_basic_package_version_file( "${PROJECT_BINARY_DIR} /${PACKAGE_NAME} -config-version.cmake"
Original file line number Diff line number Diff line change @@ -138,15 +138,14 @@ enable_language ( Fortran )
138138project ( jf_test NONE )
139139
140140find_package ( jsonfortran-${CMAKE_Fortran_COMPILER_ID} 8.2.5 REQUIRED )
141- include_directories ( "${jsonfortran_INCLUDE_DIRS}" )
142141
143142file ( GLOB JF_TEST_SRCS "src/tests/jf_test_*.F90" )
144143foreach ( UNIT_TEST ${JF_TEST_SRCS} )
145144 get_filename_component ( TEST ${UNIT_TEST} NAME_WE )
146145 add_executable ( ${TEST} ${UNIT_TEST} )
147- target_link_libraries ( ${TEST} jsonfortran-static )
146+ target_link_libraries ( ${TEST} jsonfortran::jsonfortran -static )
148147 # or for linking against the dynamic/shared library:
149- # target_link_libraries ( ${TEST} jsonfortran ) # instead
148+ # target_link_libraries ( ${TEST} jsonfortran::jsonfortran ) # instead
150149endforeach()
151150```
152151
You can’t perform that action at this time.
0 commit comments