Commit b234b960 authored by Jcl's avatar Jcl

fix compilation issue on macosx

parent fdec419b
...@@ -45,7 +45,7 @@ MESSAGE( STATUS "BUILD_TYPE =" ${RELEASE} ) ...@@ -45,7 +45,7 @@ MESSAGE( STATUS "BUILD_TYPE =" ${RELEASE} )
FIND_PACKAGE(NEMO) FIND_PACKAGE(NEMO)
FIND_PACKAGE(SQLITE3) FIND_PACKAGE(SQLITE3)
FIND_PACKAGE(HDF5 COMPONENTS CXX) FIND_PACKAGE(HDF5 COMPONENTS CXX REQUIRED)
#SET(HDF5_CXX_LIBRARIES hdf5_hl_cpp hdf5_cpp) #SET(HDF5_CXX_LIBRARIES hdf5_hl_cpp hdf5_cpp)
MESSAGE( STATUS "HDF5_CXX_LIBRARIES=" ${HDF5_CXX_LIBRARIES}) MESSAGE( STATUS "HDF5_CXX_LIBRARIES=" ${HDF5_CXX_LIBRARIES})
...@@ -85,15 +85,19 @@ STRING(REPLACE "-DNDEBUG" "" CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE} ...@@ -85,15 +85,19 @@ STRING(REPLACE "-DNDEBUG" "" CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE}
# create library "uns" # create library "uns"
add_library (unsio ${LIBTYPE} ${LIBSOURCES}) add_library (unsio ${LIBTYPE} ${LIBSOURCES})
target_link_libraries(unsio nemo)
# Manage HDF5 linking against libunsio
if(OSX) if(OSX)
set_target_properties(unsio PROPERTIES LINK_FLAGS "-undefined suppress -flat_namespace -L${NEMOLIB} -lnemo -lsqlite3") # add " " after .dylib
string(REPLACE ".dylib" ".dylib " HDF5_CXX_LIBRARIES_LIST ${HDF5_CXX_LIBRARIES})
message(STATUS "HDF5_CXX_LIBRARIES_LIST = " ${HDF5_CXX_LIBRARIES_LIST})
set_target_properties(unsio PROPERTIES LINK_FLAGS "-undefined suppress -flat_namespace ${HDF5_CXX_LIBRARIES_LIST} -L${NEMOLIB} -lnemo -lsqlite3")
else(OSX) else(OSX)
# libk unsio against hdf5 and sqlit3
# add " " after .so # add " " after .so
string(REPLACE ".so" ".so " HDF5_CXX_LIBRARIES_LIST ${HDF5_CXX_LIBRARIES}) string(REPLACE ".so" ".so " HDF5_CXX_LIBRARIES_LIST ${HDF5_CXX_LIBRARIES})
message(STATUS "HDF5_CXX_LIBRARIES_LIST = " ${HDF5_CXX_LIBRARIES_LIST}) message(STATUS "HDF5_CXX_LIBRARIES_LIST = " ${HDF5_CXX_LIBRARIES_LIST})
# libk unsio against hdf5 and sqlit3
set_target_properties(unsio PROPERTIES LINK_FLAGS "${HDF5_CXX_LIBRARIES_LIST} -lsqlite3") set_target_properties(unsio PROPERTIES LINK_FLAGS "${HDF5_CXX_LIBRARIES_LIST} -lsqlite3")
endif(OSX) endif(OSX)
...@@ -165,7 +169,7 @@ FOREACH(exe_cpp ${execpp_sources}) ...@@ -165,7 +169,7 @@ FOREACH(exe_cpp ${execpp_sources})
add_executable (${exe} ${exe_cpp}) add_executable (${exe} ${exe_cpp})
# Link the executable to the Hello library. # Link the executable to the Hello library.
target_link_libraries (${exe} unsio nemo ${FC_GFORT_LIB} ${FC_G77_LIB} stdc++) target_link_libraries (${exe} unsio ${FC_GFORT_LIB} ${FC_G77_LIB} stdc++)
IF (${exe} STREQUAL "uns_info") IF (${exe} STREQUAL "uns_info")
INSTALL(TARGETS ${exe} RUNTIME DESTINATION bin) INSTALL(TARGETS ${exe} RUNTIME DESTINATION bin)
ENDIF() ENDIF()
...@@ -184,7 +188,7 @@ FOREACH(exe_f ${exe_sources}) ...@@ -184,7 +188,7 @@ FOREACH(exe_f ${exe_sources})
# Link the executable to the Hello library. # Link the executable to the Hello library.
#target_link_libraries (${exe} unsio nemomaing77 nemo g2c sqlite3 stdc++) #target_link_libraries (${exe} unsio nemomaing77 nemo g2c sqlite3 stdc++)
target_link_libraries (${exe} unsio nemomaing77 nemo ${FC_LIB} stdc++) target_link_libraries (${exe} unsio nemomaing77 ${FC_LIB} stdc++)
SET_TARGET_PROPERTIES(${exe} PROPERTIES LINKER_LANGUAGE Fortran) SET_TARGET_PROPERTIES(${exe} PROPERTIES LINKER_LANGUAGE Fortran)
# add "-lstdc++" # add "-lstdc++"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment