# Command lines: # Windows: # cd ..\..\Build # mkdir UDP_Receiver # cd UDP_Receiver # cmake -C ..\..\Network\UDP_Receiver\initial_cache.cmake -G "Visual Studio 12 Win64" ..\..\Network\UDP_Receiver -DCMAKE_INSTALL_PREFIX=..\Install # Linux # mkdir -p ../../Build/UDP_Receiver # cd ../../Build/UDP_Receiver # cmake -C ../../Network/UDP_Receiver/initial_cache.cmake -G "Unix Makefiles" ../../Network/UDP_Receiver -DCMAKE_INSTALL_PREFIX=../Install project(udpreceiver) if(UNIX) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=gnu++0x") else(UNIX) include_directories("C:\\local\\boost_1_55_0") link_directories("C:\\local\\boost_1_55_0\\lib64-msvc-12.0") endif() cmake_minimum_required(VERSION 2.8) set(udpreceiver_VERSION_MAJOR 0) set(udpreceiver_VERSION_MINOR 1) set(udpreceiver_VERSION_PATCH 0) set(Boost_USE_STATIC_LIBS ON) if(UNIX) # It looks like this only works for Linux # find_package(Boost 1.55.0 COMPONENTS system date_time regex REQUIRED) find_package(Boost 1.46.0 COMPONENTS system date_time regex REQUIRED) if(Boost_FOUND) message(STATUS "Boost found at ${Boost_INCLUDE_DIRS}") else(Boost_FOUND) message(FATAL_ERROR "Boost not found") endif() endif() include_directories(${Boost_INCLUDE_DIRS}) #add_definitions(-DBOOST_ALL_DYN_LINK) # Link against the dynamic boost lib. Seems to be necessary because we use /MD, i.e. link to the dynamic CRT. #add_definitions(-DBOOST_ALL_NO_LIB) # Don't use the automatic library linking by boost with VS2010 (#pragma ...). Instead, we specify everything in cmake. # To copy Boost DLLs to the target directory # get_filename_component(BOOST_SYS_BASE_NAME "${Boost_SYSTEM_FRAMEWORK_LIBRARY_RELEASE}" NAME_WE) # get_filename_component(BOOST_SYS_PATH "${Boost_SYSTEM_FRAMEWORK_LIBRARY_RELEASE" PATH) # Source and header files: set(SOURCE main.cpp ) set(HEADERS ) add_executable(udpreceiver ${SOURCE} ${HEADERS}) if(UNIX) target_link_libraries(udpreceiver ${Boost_SYSTEM_LIBRARY}) target_link_libraries(udpreceiver pthread) else(UNIX) target_link_libraries(udpreceiver ${Boost_LIBRARIES}) endif() configure_file(params.json ${CMAKE_CURRENT_BINARY_DIR}/params.json COPYONLY) install(TARGETS udpreceiver DESTINATION bin #CONFIGURATIONS Release ) install(FILES params.json DESTINATION bin #CONFIGURATIONS Release ) # ${BOOST_SYS_PATH}/${BOOST_SYS_BASE_NAME}.dll include(InstallRequiredSystemLibraries) # This module will include any runtime libraries that are needed by the project for the current platform set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") set(CPACK_PACKAGE_VERSION_MAJOR "${udpreceiver_VERSION_MAJOR}") set(CPACK_PACKAGE_VERSION_MINOR "${udpreceiver_VERSION_MINOR}") set(CPACK_PACKAGE_VERSION_PATCH "${udpreceiver_VERSION_PATCH}") include(CPack)