diff --git a/LCS/CMakeLists.txt b/LCS/CMakeLists.txt index 34d18c42fb41116cd1096dae595283e594673c6c..1d5a1afc4d0477b0e6efa95c12afe9d07a84c8c1 100644 --- a/LCS/CMakeLists.txt +++ b/LCS/CMakeLists.txt @@ -1,10 +1,9 @@ - ## ------------------------------------------------------------------------------ ## Project characteristics project (LCS) -cmake_minimum_required (VERSION 2.5) +cmake_minimum_required (VERSION 2.6) ##------------------------------------------------------------------------------- ## Options @@ -14,8 +13,8 @@ option (LCS_BUILD_TESTS "Build test programs?" FALSE) ## ------------------------------------------------------------------------------ ## Set CMAKE_MODULE_PATH to load custom CMake modules -if (NOT USG_ROOT) -find_path (USG_ROOT cmake/CMakeSettings.cmake +if (NOT LOFAR_ROOT) +find_path (LOFAR_ROOT cmake/modules/CMakeSettings.cmake PATHS ${LCS_SOURCE_DIR} ${LCS_SOURCE_DIR}/.. @@ -24,21 +23,12 @@ find_path (USG_ROOT cmake/CMakeSettings.cmake $ENV{LOFARSOFT} ) -if (USG_ROOT) - include (${USG_ROOT}/cmake/CMakeSettings.cmake) -else (USG_ROOT) +if (LOFAR_ROOT) + include (${LOFAR_ROOT}/cmake/CMakeSettings.cmake) +else (LOFAR_ROOT) message (FATAL_ERROR "Unable to locate additional CMake scripts!") -endif (USG_ROOT) -endif (NOT USG_ROOT) - -## ------------------------------------------------------------------------------ -## Commonly used configuration files - -set (LCS_config ${LCS_BINARY_DIR}/lofar_config.h) - -file (WRITE ${LCS_config} "/* lofar_config.h -- Generated by CMake. */\n\n") - -include_directories (${LCS_BINARY_DIR}) +endif (LOFAR_ROOT) +endif (NOT LOFAR_ROOT) ## ------------------------------------------------------------------------------ ## Additional CMake modules @@ -56,88 +46,80 @@ enable_testing() ## ------------------------------------------------------------------------------ ## Check system libraries -check_include_files (sys/socket.h HAVE_SYS_SOCKET_H ) -check_include_files (sys/types.h HAVE_SYS_TYPES_H ) -check_include_files (unistd.h HAVE_UNISTD_H ) -check_include_files (stdarg.h HAVE_STDARG_H ) -check_include_files (time.h HAVE_TIME_H ) -check_include_files (stdio.h HAVE_STDIO_H ) -check_include_files (netinet/in.h HAVE_NETINET_IN_H ) - -if (HAVE_SYS_TYPES_H) - check_type_size ("uint" HAVE_UINT) - if (HAVE_UINT) - add_definitions (-DHAVE_UINT) - endif (HAVE_UINT) - ## - check_type_size ("long" HAVE_LONG) - if (HAVE_LONG) - add_definitions (-DHAVE_LONG) - endif (HAVE_LONG) - ## - check_type_size ("long long" HAVE_LONGLONG) - if (HAVE_LONGLONG) - add_definitions (-DHAVE_LONGLONG) - endif (HAVE_LONGLONG) - ## - check_type_size ("ushort" HAVE_USHORT) - if (HAVE_USHORT) - add_definitions (-DHAVE_USHORT) - endif (HAVE_USHORT) -else (HAVE_SYS_TYPES_H) - message (STATUS "Unable to find sys/types.h") -endif (HAVE_SYS_TYPES_H) - ## ------------------------------------------------------------------------------ ## Search for external libraries -## Boost++ +## ------------------------------------------------------------------------------ +## Check for required tools -include (${USG_ROOT}/cmake/FindBoost.cmake) +## ------------------------------------------------------------------------------ +## Module header files -if (BOOST_INCLUDES) - include_directories (${BOOST_INCLUDES}) - add_definitions (-DHAVE_BOOST) -endif (BOOST_INCLUDES) -## casacore +## ------------------------------------------------------------------------------ +## Directories to be included in the build -include (${USG_ROOT}/cmake/FindCASACORE.cmake) +## --- Tools ---------------------------------------- -if (CASACORE_INCLUDES) - include_directories (${CASACORE_INCLUDES}) - add_definitions (-DHAVE_AIPSPP) -endif (CASACORE_INCLUDES) +find_path (HAVE_TOOLS CMakeLists.txt ${LOFAR_SOURCE_DIR}/LCS/Tools) +if (HAVE_TOOLS) + set (HAVE_TOOLS TRUE CACHE BOOL "Have package Tools?" FORCE) + add_subdirectory (Tools) +endif (HAVE_TOOLS) -## ------------------------------------------------------------------------------ -## Check for required tools +## --- Common --------------------------------------- -find_program ( bison_bin bison ) -find_program ( flex_bin flex ) -find_program ( yacc_bin yacc ) +find_path (HAVE_COMMON CMakeLists.txt ${LOFAR_SOURCE_DIR}/LCS/Common) +if (HAVE_COMMON) + set (HAVE_COMMON TRUE CACHE BOOL "Have package Common?" FORCE) + add_subdirectory (Common) +endif (HAVE_COMMON) -## ------------------------------------------------------------------------------ -## Module header files +## --- ACC ------------------------------------------ -include_directories ( - ${LCS_SOURCE_DIR}/Blob/include - ${LCS_SOURCE_DIR}/Common/include - ${LCS_SOURCE_DIR}/ACC/ALC/include - ${LCS_SOURCE_DIR}/ACC/APS/include - ${LCS_SOURCE_DIR}/ACC/PLC/include - ${LCS_SOURCE_DIR}/AMC/AMCBase/include - ${LCS_SOURCE_DIR}/AMC/AMCImpl/include - ${LCS_SOURCE_DIR}/Transport/include - ) +find_path (HAVE_ACC CMakeLists.txt ${LOFAR_SOURCE_DIR}/LCS/ACC) +if (HAVE_ACC) + set (HAVE_ACC TRUE CACHE BOOL "Have package ACC?" FORCE) + add_subdirectory (ACC) +endif (HAVE_ACC) -## ------------------------------------------------------------------------------ -## Directories to be included in the build +## --- AMC ------------------------------------------ + +find_path (HAVE_AMC CMakeLists.txt ${LOFAR_SOURCE_DIR}/LCS/AMC) +if (HAVE_AMC) + set (HAVE_AMC TRUE CACHE BOOL "Have package AMC?" FORCE) + add_subdirectory (AMC) +endif (HAVE_AMC) + +## --- BLOB ----------------------------------------- + +find_path (HAVE_BLOB CMakeLists.txt ${LOFAR_SOURCE_DIR}/LCS/Blob) +if (HAVE_BLOB) + set (HAVE_BLOB TRUE CACHE BOOL "Have package Blob?" FORCE) + add_subdirectory (Blob) +endif (HAVE_BLOB) + +## --- TRANSPORT ------------------------------------ + +find_path (HAVE_TRANSPORT CMakeLists.txt ${LOFAR_SOURCE_DIR}/LCS/Transport) +if (HAVE_TRANSPORT) + set (HAVE_TRANSPORT TRUE CACHE BOOL "Have package Transport?" FORCE) + add_subdirectory (Transport) +endif (HAVE_TRANSPORT) + +## --- STREAM --------------------------------------- + +find_path (HAVE_STREAM CMakeLists.txt ${LOFAR_SOURCE_DIR}/LCS/Stream) +if (HAVE_STREAM) + set (HAVE_STREAM TRUE CACHE BOOL "Have package Stream?" FORCE) + add_subdirectory (Stream) +endif (HAVE_STREAM) + +## --- APPLCOMMON ----------------------------------- + +find_path (HAVE_APPLCOMMON CMakeLists.txt ${LOFAR_SOURCE_DIR}/LCS/ApplCommon) +if (HAVE_APPLCOMMON) + set (HAVE_APPLCOMMON TRUE CACHE BOOL "Have package ApplCommon?" FORCE) + add_subdirectory (ApplCommon) +endif (HAVE_APPLCOMMON) -add_subdirectory (ACC) -add_subdirectory (AMC) -add_subdirectory (Blob) -add_subdirectory (Common) -#add_subdirectory (LACE) -#add_subdirectory (Math) -add_subdirectory (Tools) -add_subdirectory (Transport)