Skip to content

Commit

Permalink
Update CMakeLists.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
MaJerle committed Sep 30, 2022
1 parent 884a552 commit 9f25382
Showing 1 changed file with 42 additions and 48 deletions.
90 changes: 42 additions & 48 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,52 +3,46 @@ cmake_minimum_required(VERSION 3.22)
# Setup project
project(LwLibPROJECT)

# -------------------------------------------------
# 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 /lwow/CMakeLists.txt instead
if (NOT PROJECT_IS_TOP_LEVEL)
message(FATAL_ERROR "This CMakeLists.txt can only be used as top-level. Use /lwow/CMakeLists.txt for library include purpose")
if(NOT PROJECT_IS_TOP_LEVEL)
add_subdirectory(lwow)
else()
# Set as executable
add_executable(${PROJECT_NAME})

# Add key executable block
target_sources(${PROJECT_NAME} PUBLIC
${CMAKE_CURRENT_LIST_DIR}/dev/main.c

# Port files
${CMAKE_CURRENT_LIST_DIR}/lwow/src/system/lwow_sys_win32.c
${CMAKE_CURRENT_LIST_DIR}/lwow/src/system/lwow_ll_win32.c
)

# Add key include paths
target_include_directories(${PROJECT_NAME} PUBLIC
${CMAKE_CURRENT_LIST_DIR}
${CMAKE_CURRENT_LIST_DIR}/dev
)

# Compilation definition information
target_compile_definitions(${PROJECT_NAME} PUBLIC
WIN32
_DEBUG
CONSOLE
LWOW_DEV
)

# Compiler options
target_compile_options(${PROJECT_NAME} PRIVATE
-Wall
-Wextra
-Wpedantic
)

# Add subdir with lwow and link to the project
add_subdirectory(lwow)
target_link_libraries(${PROJECT_NAME} lwow)
target_link_libraries(${PROJECT_NAME} lwow_devices)
add_subdirectory(snippets)
target_link_libraries(${PROJECT_NAME} lwow_snippets)
endif()

# Set as executable
add_executable(${PROJECT_NAME})

# Add key executable block
target_sources(${PROJECT_NAME} PUBLIC
${CMAKE_CURRENT_LIST_DIR}/dev/main.c

# Port files
${CMAKE_CURRENT_LIST_DIR}/lwow/src/system/lwow_sys_win32.c
${CMAKE_CURRENT_LIST_DIR}/lwow/src/system/lwow_ll_win32.c
)

# Add key include paths
target_include_directories(${PROJECT_NAME} PUBLIC
${CMAKE_CURRENT_LIST_DIR}
${CMAKE_CURRENT_LIST_DIR}/dev
)

# Compilation definition information
target_compile_definitions(${PROJECT_NAME} PUBLIC
WIN32
_DEBUG
CONSOLE
LWOW_DEV
)

# Compiler options
target_compile_options(${PROJECT_NAME} PRIVATE
-Wall
-Wextra
-Wpedantic
)

# Add subdir with lwow and link to the project
add_subdirectory("lwow")
target_link_libraries(${PROJECT_NAME} lwow)
target_link_libraries(${PROJECT_NAME} lwow_devices)
add_subdirectory("snippets")
target_link_libraries(${PROJECT_NAME} lwow_snippets)

0 comments on commit 9f25382

Please sign in to comment.