lwmem/CMakeLists.txt

55 lines
1.4 KiB
CMake
Raw Normal View History

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
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
2022-01-08 15:44:18 +01:00
${CMAKE_CURRENT_LIST_DIR}/dev/main.cpp
2021-12-24 15:19:24 +01:00
${CMAKE_CURRENT_LIST_DIR}/tests/lwmem_test.c
# win32 port
${CMAKE_CURRENT_LIST_DIR}/lwmem/src/system/lwmem_sys_win32.c
2021-12-24 15:19:24 +01:00
)
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}
${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
)
# Compiler and linker options
target_compile_options(${PROJECT_NAME} PRIVATE
${CPU_PARAMETERS}
-Wall
-Wextra
-Wpedantic
-Wno-unused-parameter
)
2021-12-24 15:19:24 +01:00
# Add subdir with lwmem and link to the project
add_subdirectory("lwmem")
target_link_libraries(${PROJECT_NAME} lwmem)
2022-01-08 16:12:49 +01:00
target_link_libraries(${PROJECT_NAME} lwmem_cpp)