58 lines
1.7 KiB
CMake
58 lines
1.7 KiB
CMake
cmake_minimum_required(VERSION 3.5)
|
|
|
|
project(mason
|
|
VERSION 0.0.1
|
|
DESCRIPTION "Javascript application project build tool"
|
|
LANGUAGES CXX
|
|
)
|
|
|
|
cmake_policy(SET CMP0076 NEW)
|
|
cmake_policy(SET CMP0077 NEW)
|
|
cmake_policy(SET CMP0079 NEW)
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
|
|
include(GNUInstallDirs)
|
|
|
|
if (CMAKE_BUILD_TYPE STREQUAL "Release")
|
|
list(APPEND COMPILE_OPTIONS -O3)
|
|
elseif (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
list(APPEND COMPILE_OPTIONS -g)
|
|
list(APPEND COMPILE_OPTIONS -Wall)
|
|
list(APPEND COMPILE_OPTIONS -Wextra)
|
|
endif()
|
|
|
|
find_package(nlohmann_json REQUIRED)
|
|
find_package(CURL REQUIRED)
|
|
find_package(LibArchive REQUIRED)
|
|
|
|
add_executable(${PROJECT_NAME})
|
|
|
|
target_compile_options(${PROJECT_NAME} PRIVATE ${COMPILE_OPTIONS})
|
|
|
|
set_property(TARGET ${PROJECT_NAME} PROPERTY VERSION ${version})
|
|
set_property(TARGET ${PROJECT_NAME} PROPERTY SOVERSION 1)
|
|
set_property(TARGET ${PROJECT_NAME} PROPERTY
|
|
INTERFACE_${PROJECT_NAME}_MAJOR_VERSION 1)
|
|
set_property(TARGET ${PROJECT_NAME} APPEND PROPERTY
|
|
COMPATIBLE_INTERFACE_STRING ${PROJECT_NAME}_MAJOR_VERSION
|
|
)
|
|
|
|
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
|
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src2)
|
|
|
|
add_subdirectory(src)
|
|
add_subdirectory(src2)
|
|
add_subdirectory(test)
|
|
|
|
target_link_libraries(${PROJECT_NAME} PRIVATE nlohmann_json::nlohmann_json)
|
|
target_link_libraries(${PROJECT_NAME} PRIVATE CURL::libcurl)
|
|
target_link_libraries(${PROJECT_NAME} PRIVATE LibArchive::LibArchive)
|
|
|
|
install(TARGETS ${PROJECT_NAME}
|
|
EXPORT ${PROJECT_NAME}Targets
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}
|
|
)
|