40 lines
1.1 KiB
CMake
40 lines
1.1 KiB
CMake
cmake_minimum_required(VERSION 3.12)
|
|
project(helloalloc VERSION 0.0.0)
|
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON) # Group CMake targets inside a folder
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # Generate compile_commands.json for language servers
|
|
|
|
find_package(fmt CONFIG REQUIRED)
|
|
|
|
if (NOT MSVC)
|
|
set(TARGET_OPTIONS
|
|
"-Wall"
|
|
"-Wextra"
|
|
"-Wconversion"
|
|
"-Wpedantic"
|
|
"-Wshadow"
|
|
"-Werror"
|
|
)
|
|
else()
|
|
string(JOIN " " TARGET_DEFINTIONS
|
|
${TARGET_DEFINTIONS}
|
|
"_WIN32_WINNT=0x0A00"
|
|
)
|
|
set(TARGET_OPTIONS
|
|
"/W4"
|
|
"/WX"
|
|
)
|
|
endif()
|
|
|
|
# source files and includes
|
|
set(TARGET_NAME helloalloc)
|
|
set(TARGET_SOURCE_FILES
|
|
"helloalloc.cpp"
|
|
)
|
|
add_executable(${TARGET_NAME} ${TARGET_SOURCE_FILES})
|
|
target_include_directories(${TARGET_NAME} PRIVATE "${PROJECT_SOURCE_DIR}")
|
|
# target_compile_definitions(${TARGET_NAME} PRIVATE ${TARGET_DEFINTIONS})
|
|
target_compile_features(${TARGET_NAME} PRIVATE cxx_std_20)
|
|
target_link_libraries(${TARGET_NAME} PUBLIC fmt::fmt-header-only)
|
|
source_group(TREE "${CMAKE_CURRENT_LIST_DIR}" FILES ${TARGET_SOURCE_FILES})
|
|
|