mirror of
https://github.com/MaJerle/lwshell.git
synced 2025-01-13 12:52:52 +08:00
Improve the CMakeLists library usage
This commit is contained in:
parent
94a74e3aa4
commit
b261ba5f1c
@ -6,36 +6,20 @@ project(LwLibPROJECT)
|
||||
if(NOT PROJECT_IS_TOP_LEVEL)
|
||||
add_subdirectory(lwshell)
|
||||
else()
|
||||
# Set as executable
|
||||
add_executable(${PROJECT_NAME})
|
||||
|
||||
# Add key executable block
|
||||
target_sources(${PROJECT_NAME} PUBLIC
|
||||
target_sources(${PROJECT_NAME} PRIVATE
|
||||
${CMAKE_CURRENT_LIST_DIR}/dev/main.c
|
||||
)
|
||||
|
||||
# Add key include paths
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC
|
||||
${CMAKE_CURRENT_LIST_DIR}/dev
|
||||
)
|
||||
|
||||
# Compilation definition information
|
||||
target_compile_definitions(${PROJECT_NAME} PUBLIC
|
||||
WIN32
|
||||
_DEBUG
|
||||
CONSOLE
|
||||
LWSHELL_DEV
|
||||
)
|
||||
|
||||
# Compiler options
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE
|
||||
-Wall
|
||||
-Wextra
|
||||
-Wpedantic
|
||||
)
|
||||
|
||||
# Add subdir with lwshell and link to project
|
||||
set(LWSHELL_OPTS_FILE ${CMAKE_CURRENT_LIST_DIR}/dev/lwshell_opts.h)
|
||||
add_subdirectory(lwshell)
|
||||
target_link_libraries(${PROJECT_NAME} lwshell)
|
||||
|
||||
# Add compile options to the library, which will propagate options to executable through public link
|
||||
target_compile_definitions(lwshell PUBLIC WIN32 _DEBUG CONSOLE LWSHELL_DEV)
|
||||
target_compile_options(lwshell PUBLIC -Wall -Wextra -Wpedantic)
|
||||
endif()
|
||||
|
Loading…
x
Reference in New Issue
Block a user