cmake_minimum_required(VERSION 3.18) project(shared) message (STATUS "Running protobuf precompiler") execute_process ( COMMAND protoc --proto_path=./net/lib/protobuf --cpp_out=./net/lib/protobuf/ ./net/lib/protobuf/net.proto WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) file (GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS "*.cc" ) file (GLOB_RECURSE HEADER_FILES CONFIGURE_DEPENDS "*.hh" ) add_library(${PROJECT_NAME} STATIC ${SOURCE_FILES} ) find_library(LIB_PROTOBUF protobuf libprotobuf REQUIRED) set(PROTOBUF_LIBRARY "protobuf::libprotobuf") find_package(Boost COMPONENTS iostreams REQUIRED) find_package(Threads REQUIRED) find_package(Backtrace REQUIRED) target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wshadow -Wdouble-promotion -Wformat=2 -Wundef -fno-common -Wconversion -Wpedantic -std=c++20 -O2 -Wno-exceptions -Wno-missing-field-initializers -Wno-unknown-pragmas ) if (${IS_DEBUG}) target_compile_options(${PROJECT_NAME} PRIVATE ¦ -fstack-protector-strong -fno-omit-frame-pointer -fsanitize=undefined ) target_link_options(${PROJECT_NAME} PRIVATE ¦ -fstack-protector-strong -fsanitize=undefined ) endif() target_include_directories(${PROJECT_NAME} PRIVATE "${PROJECT_SOURCE_DIR}/../../src" ) target_link_libraries(${PROJECT_NAME} PRIVATE ${LIB_PROTOBUF} ${Backtrace_LIBRARIES} ${Threads_LIBRARIES} ${Boost_LIBRARIES} ${FREETYPE_LIBRARIES} ) target_precompile_headers(${PROJECT_NAME} PRIVATE ${HEADER_FILES} )