Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake fixes #6

Merged
merged 1 commit into from
Apr 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 9 additions & 15 deletions sorc/fre-nctools.fd/shared_lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,21 @@ set(c_src
read_mosaic.c
tool_util.c)

add_definitions(-Duse_netCDF)

if(CMAKE_C_COMPILER_ID MATCHES "^(Intel)$")
set(CMAKE_C_FLAGS "-traceback")
set(CMAKE_C_FLAGS_RELEASE "-O2")
set(CMAKE_C_FLAGS_DEBUG
"-O0"
)
set(CMAKE_C_FLAGS_DEBUG "-O0")
elseif(CMAKE_C_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$")
set(CMAKE_C_FLAGS " ")
set(CMAKE_C_FLAGS_RELEASE " ")
set(CMAKE_C_FLAGS_DEBUG " "
)
set(CMAKE_C_FLAGS_DEBUG " ")
endif()

set(lib_name shared_all)
add_library(${lib_name} STATIC ${c_src})
target_include_directories(
${lib_name} PRIVATE)
target_link_libraries(
${lib_name}
NetCDF::NetCDF_C)
add_library(shared_all STATIC ${c_src})
target_compile_definitions(shared_all PRIVATE use_netCDF)

target_include_directories(shared_all PUBLIC ${CURRENT_SOURCE_DIR})

target_link_libraries(shared_all NetCDF::NetCDF_C)

install(TARGETS ${lib_name} RUNTIME DESTINATION ./)
install(TARGETS shared_all RUNTIME DESTINATION lib)
25 changes: 8 additions & 17 deletions sorc/fre-nctools.fd/tools/make_hgrid/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,21 @@ set(c_src
create_lonlat_grid.c
make_hgrid.c)

set ( PROJECT_LINK_LIBS libshared_all.a )
link_directories(${CMAKE_CURRENT_BINARY_DIR}/../../shared_lib)
include_directories(../../shared_lib)

if(CMAKE_C_COMPILER_ID MATCHES "^(Intel)$")
set(CMAKE_C_FLAGS "-traceback")
set(CMAKE_C_FLAGS_RELEASE "-O2")
set(CMAKE_C_FLAGS_DEBUG
"-O0"
)
set(CMAKE_C_FLAGS_DEBUG "-O0")

elseif(CMAKE_C_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$")
set(CMAKE_C_FLAGS " ")
set(CMAKE_C_FLAGS_RELEASE " ")
set(CMAKE_C_FLAGS_DEBUG " "
)
set(CMAKE_C_FLAGS_DEBUG " ")
endif()

set(exe_name make_hgrid)
add_executable(${exe_name} ${c_src})
target_include_directories(
${exe_name} PRIVATE)
target_link_libraries(
${exe_name}
${PROJECT_LINK_LIBS}
add_executable(make_hgrid ${c_src})

target_link_libraries(make_hgrid
shared_all
NetCDF::NetCDF_C)

install(TARGETS ${exe_name} RUNTIME DESTINATION exec)
install(TARGETS make_hgrid RUNTIME DESTINATION exec)