# CMakeLists.txt of mscb project cmake_minimum_required(VERSION 3.5) project(mscb) # compile options option(SHARED_LIBRARY "Changes the MSCB Library from STATIC to SHARED" OFF) if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) # in standalone mode, install under /bin set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR}) else() # there is an user choice or a higher level project # specifying the install path - keep that set(CMAKE_INSTALL_PREFIX "${PROJECT_SOURCE_DIR}" CACHE PATH "") endif() message(STATUS "MSCB: CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}") set(CMAKE_CXX_STANDARD 11) set(OBJS src/msc.cxx src/mscb.cxx src/mscbrpc.cxx src/cmdedit.cxx src/mstrlcpy.cxx mxml/mxml.cxx ) add_executable(msc ${OBJS}) if(SHARED_LIBRARY) add_library(mscb SHARED src/mscb.cxx src/mscbrpc.cxx mxml/mxml.cxx mxml/mstrlcpy.cxx ) else() add_library(mscb STATIC src/mscb.cxx src/mscbrpc.cxx src/mstrlcpy.cxx mxml/mxml.cxx ) endif() target_include_directories(msc PRIVATE ${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/mxml) target_include_directories(mscb PUBLIC ${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/mxml) if (WIN32) target_link_libraries(msc wsock32 ws2_32) endif() if (UNIX) target_link_libraries(msc pthread) endif() install(TARGETS msc DESTINATION bin) install(TARGETS mscb DESTINATION lib)