cmake_minimum_required(VERSION 3.20.2) project(opensilecs VERSION 2.5.0) include(CTest) enable_testing() option(BUILD_COMMUNICATION_LIB_ONLY "Setup only the Silecs communication library." OFF) option(ADD_LATEST_LINK "Link this install release as latest." ON) set(GSI_SILECS_PATH "/common/usr/cscofe/silecs" CACHE STRING "GSI_SILECS_PATH") set(BUILD_TARGET "x86_64" CACHE STRING "BUILD_TARGET") # Use, i.e. don't skip the full RPATH for the build tree. set(CMAKE_SKIP_BUILD_RPATH FALSE) # When building, don't use the install RPATH already (but later on when installing). set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) # Add the automatically determined parts of the RPATH which point to directories outside the build # tree to the install RPATH. set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) if (BUILD_COMMUNICATION_LIB_ONLY) add_subdirectory(silecs-communication-cpp) else() add_subdirectory(silecs_cli) add_subdirectory(silecs-codegen) add_subdirectory(silecs-model) add_subdirectory(silecs-communication-cpp) add_subdirectory(silecs-cli-client) add_subdirectory(silecs-diagnostic-cpp) # Create a silecs_environment file which can be sourced to use the silecs command line tools. FILE(WRITE ${CMAKE_BINARY_DIR}/silecs_environment "SILECS_VERSION=${CMAKE_PROJECT_VERSION}\n" "export PATH=${CMAKE_INSTALL_PREFIX}/\$SILECS_VERSION/silecs-cli:\${PATH}\n" "export PATH=${CMAKE_INSTALL_PREFIX}/\$SILECS_VERSION/silecs-cli-client/bin/x86_64:\${PATH}\n" "export PATH=${CMAKE_INSTALL_PREFIX}/\$SILECS_VERSION/silecs-diagnostic-cpp/bin/x86_64:\${PATH}\n" ) # The silecs_environment file is released/installed together with the other sub-projects. install( FILES ${CMAKE_BINARY_DIR}/silecs_environment DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_PROJECT_VERSION}/ ) endif() if(ADD_LATEST_LINK) # Symlink this release as latest. install(CODE "execute_process( \ COMMAND ${CMAKE_COMMAND} -E create_symlink \ ${CMAKE_INSTALL_PREFIX}/${CMAKE_PROJECT_VERSION} \ ${CMAKE_INSTALL_PREFIX}/latest )" ) endif()