2021-12-13 09:40:04 +01:00
|
|
|
cmake_minimum_required(VERSION 3.0.0)
|
2021-12-23 22:23:39 +01:00
|
|
|
|
|
|
|
# Setup project
|
2021-12-24 18:57:03 +01:00
|
|
|
project(LwLibPROJECT)
|
2021-12-13 09:40:04 +01:00
|
|
|
|
2021-12-24 15:19:24 +01:00
|
|
|
# -------------------------------------------------
|
|
|
|
# This CMakeLists.txt is used only if it is a top-level file.
|
|
|
|
# Purpose of it is to be able to compile project in standalone way only
|
|
|
|
#
|
|
|
|
# When library sources are to be included in another project
|
|
|
|
# user shall use /lwmem/CMakeLists.txt instead
|
|
|
|
if (NOT PROJECT_IS_TOP_LEVEL)
|
|
|
|
message(FATAL_ERROR "This CMakeLists.txt can only be used as top-level. Use /lwmem/CMakeLists.txt for library include purpose")
|
|
|
|
endif()
|
2021-12-13 09:40:04 +01:00
|
|
|
|
2021-12-24 15:19:24 +01:00
|
|
|
# Set as executable
|
|
|
|
add_executable(${PROJECT_NAME})
|
2021-12-13 09:40:04 +01:00
|
|
|
|
2021-12-24 15:19:24 +01:00
|
|
|
# Add key executable block
|
|
|
|
target_sources(${PROJECT_NAME} PUBLIC
|
2021-12-24 19:44:26 +01:00
|
|
|
${CMAKE_CURRENT_LIST_DIR}/dev/main.c
|
2021-12-24 15:19:24 +01:00
|
|
|
${CMAKE_CURRENT_LIST_DIR}/tests/lwmem_test.c
|
|
|
|
)
|
2021-12-13 09:40:04 +01:00
|
|
|
|
2021-12-24 15:19:24 +01:00
|
|
|
# Add key include paths
|
|
|
|
target_include_directories(${PROJECT_NAME} PUBLIC
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}
|
2021-12-24 19:44:26 +01:00
|
|
|
${CMAKE_CURRENT_LIST_DIR}/dev
|
2021-12-24 15:19:24 +01:00
|
|
|
)
|
2021-12-13 09:40:04 +01:00
|
|
|
|
2021-12-24 15:19:24 +01:00
|
|
|
# Compilation definition information
|
|
|
|
target_compile_definitions(${PROJECT_NAME} PUBLIC
|
|
|
|
WIN32
|
|
|
|
_DEBUG
|
|
|
|
CONSOLE
|
|
|
|
LWMEM_DEV
|
|
|
|
)
|
|
|
|
|
|
|
|
# Add subdir with lwmem and link to the project
|
|
|
|
add_subdirectory("lwmem")
|
|
|
|
target_link_libraries(${PROJECT_NAME} lwmem)
|