feat: C++ CMake template
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
cmake_minimum_required(VERSION 3.21)
|
||||
project(cppcourse VERSION 0.0.0)
|
||||
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
# Add the deps directory to the module path
|
||||
# Required for find_package injection
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/deps")
|
||||
|
||||
# Platform and compiler detection
|
||||
include(Platform)
|
||||
include(Flags)
|
||||
|
||||
# Dependencies
|
||||
find_package(fmt REQUIRED)
|
||||
|
||||
# Main executable
|
||||
add_executable(hello "hello.cpp")
|
||||
target_include_directories(hello PRIVATE ".")
|
||||
target_compile_features(hello PRIVATE cxx_std_23)
|
||||
target_compile_options(hello PRIVATE ${BASE_OPTIONS})
|
||||
target_compile_definitions(hello PRIVATE ${BASE_DEFINITIONS})
|
||||
target_link_libraries(hello PRIVATE fmt::fmt)
|
||||
Reference in New Issue
Block a user