From 3c7c7fa73aca1979dfad64354578d2c01ad9cf3e Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Tue, 26 May 2015 15:16:33 +0200 Subject: [PATCH] Set library path in StartServer script + Fix error with the executable name --- CMakeLists.txt | 16 ++++++++++------ scripts/StartServer.in | 2 +- src/CLIENT/CMakeLists.txt | 8 ++++---- src/SERVER/CMakeLists.txt | 10 +++++----- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f96d84e..66ab3bb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,11 +2,6 @@ cmake_minimum_required(VERSION 2.6) PROJECT(DDServer) -configure_file ( - "${CMAKE_SOURCE_DIR}/scripts/StartServer.in" - "${CMAKE_SOURCE_DIR}/scripts/StartServer" -) - set(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/build/${CMAKE_BUILD_TYPE}/bin/) set(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/build/${CMAKE_BUILD_TYPE}/lib/) @@ -14,10 +9,12 @@ if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) #64 bits set(CMAKE_C_FLAGS_DEBUG "-ggdb -DLINUX -Dlinux -m64 -march=core2 -fPIC -D_REENTRANT -pthread") set(CMAKE_C_FLAGS_RELEASE "-DLINUX -Dlinux -m64 -march=core2 -fPIC -D_REENTRANT -pthread") + set(USRLIB_DIR "/usr/lib64/:/usr/local/lib64/") else( CMAKE_SIZEOF_VOID_P EQUAL 8 ) #32 bits set(CMAKE_C_FLAGS_DEBUG "-ggdb -DLINUX -march=i686 -fPIC -Dlinux -D_REENTRANT -malign-double -pthread") set(CMAKE_C_FLAGS_DEBUG "-DLINUX -march=i686 -fPIC -Dlinux -D_REENTRANT -malign-double -pthread") + set(USRLIB_DIR "/usr/lib/:/usr/local/lib/") endif( CMAKE_SIZEOF_VOID_P EQUAL 8 ) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/") @@ -26,7 +23,14 @@ find_package( Threads REQUIRED ) find_package( CRYPT REQUIRED ) find_package( NetCDF REQUIRED ) -MESSAGE( STATUS "Build DDServer Project" ) +get_filename_component(NETCDFLIB_DIR ${NETCDFLIBRARIES} PATH) + +configure_file ( + "${CMAKE_SOURCE_DIR}/scripts/StartServer.in" + "${CMAKE_SOURCE_DIR}/scripts/StartServer" +) + +MESSAGE( STATUS "Build DD_Server Project" ) add_subdirectory(src/CLIENT) add_subdirectory(src/SERVER) diff --git a/scripts/StartServer.in b/scripts/StartServer.in index edbb3a0..d008e67 100755 --- a/scripts/StartServer.in +++ b/scripts/StartServer.in @@ -6,7 +6,7 @@ DDBASE=@CMAKE_INSTALL_PREFIX@/DDBASE/DATA DDPATH=@CMAKE_INSTALL_PREFIX@/DDBASE DDLIB=@CMAKE_INSTALL_PREFIX@/lib DDBASEBIN=@CMAKE_INSTALL_PREFIX@/bin -LD_LIBRARY_PATH=$DDLIB/:/usr/local/lib64/ +LD_LIBRARY_PATH=$DDLIB/:@NETCDFLIB_DIR@:@USRLIB_DIR@ export DDBASE DDPATH DDBASEBIN DDLIB LD_LIBRARY_PATH #$DDBASEBIN/DD_Server 1>/dev/null 2>/dev/null& diff --git a/src/CLIENT/CMakeLists.txt b/src/CLIENT/CMakeLists.txt index ec237a6..f14dfb3 100644 --- a/src/CLIENT/CMakeLists.txt +++ b/src/CLIENT/CMakeLists.txt @@ -1,5 +1,5 @@ -PROJECT(DDClient) +PROJECT(DD_Client) include_directories( ${CMAKE_HOME_DIRECTORY}/src/INCLUDE/ @@ -12,11 +12,11 @@ file( ./* ) -ADD_LIBRARY( DDClient SHARED ${source_files} ) +ADD_LIBRARY( DD_Client SHARED ${source_files} ) target_link_libraries( - DDClient + DD_Client ${CMAKE_THREAD_LIBS_INIT} ) -install (TARGETS DDClient DESTINATION lib) +install (TARGETS DD_Client DESTINATION lib) diff --git a/src/SERVER/CMakeLists.txt b/src/SERVER/CMakeLists.txt index 8084f6c..2fbe06a 100644 --- a/src/SERVER/CMakeLists.txt +++ b/src/SERVER/CMakeLists.txt @@ -1,5 +1,5 @@ -PROJECT(DDServer) +PROJECT(DD_Server) include_directories( ${CMAKE_HOME_DIRECTORY}/src/INCLUDE/ @@ -13,14 +13,14 @@ file( ./* ) -ADD_EXECUTABLE (DDServer ${source_files} ) +ADD_EXECUTABLE (DD_Server ${source_files} ) target_link_libraries( - DDServer + DD_Server ${CMAKE_THREAD_LIBS_INIT} - DDClient + DD_Client ${NETCDFLIBRARY} ${CRYPT_LIBRARY} ) -install (TARGETS DDServer DESTINATION bin) +install (TARGETS DD_Server DESTINATION bin) -- libgit2 0.21.2