mirror of
https://github.com/MaJerle/lwshell.git
synced 2025-02-06 13:08:22 +08:00
Create .cmake file to allow higher flexibility of end user
This commit is contained in:
parent
293ef88fe2
commit
a6d776dee9
@ -1,11 +1,3 @@
|
|||||||
cmake_minimum_required(VERSION 3.22)
|
cmake_minimum_required(VERSION 3.22)
|
||||||
|
|
||||||
# Register core library
|
include(${CMAKE_CURRENT_LIST_DIR}/library.cmake)
|
||||||
add_library(lwshell INTERFACE)
|
|
||||||
target_sources(lwshell PUBLIC ${CMAKE_CURRENT_LIST_DIR}/src/lwshell/lwshell.c)
|
|
||||||
target_include_directories(lwshell INTERFACE ${CMAKE_CURRENT_LIST_DIR}/src/include)
|
|
||||||
|
|
||||||
# Create config file
|
|
||||||
if(DEFINED LWSHELL_OPTS_DIR AND NOT EXISTS ${LWSHELL_OPTS_DIR}/lwshell_opts.h)
|
|
||||||
configure_file(${CMAKE_CURRENT_LIST_DIR}/src/include/lwshell/lwshell_opts_template.h ${LWSHELL_OPTS_DIR}/lwshell_opts.h COPYONLY)
|
|
||||||
endif()
|
|
21
lwshell/library.cmake
Normal file
21
lwshell/library.cmake
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# Library core sources
|
||||||
|
set(lwshell_core_SRCS
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/src/lwshell/lwshell.c
|
||||||
|
)
|
||||||
|
|
||||||
|
# Setup include directories
|
||||||
|
set(lwshell_include_DIRS
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/src/include
|
||||||
|
)
|
||||||
|
|
||||||
|
# Register library to the system
|
||||||
|
add_library(lwshell INTERFACE)
|
||||||
|
target_sources(lwshell INTERFACE ${lwshell_core_SRCS})
|
||||||
|
target_include_directories(lwshell INTERFACE ${lwshell_include_DIRS})
|
||||||
|
target_compile_options(lwshell PRIVATE ${LWSHELL_COMPILE_OPTIONS})
|
||||||
|
target_compile_definitions(lwshell PRIVATE ${LWSHELL_COMPILE_DEFINITIONS})
|
||||||
|
|
||||||
|
# Create config file
|
||||||
|
if(DEFINED LWSHELL_OPTS_DIR AND NOT EXISTS ${LWSHELL_OPTS_DIR}/lwshell_opts.h)
|
||||||
|
configure_file(${CMAKE_CURRENT_LIST_DIR}/src/include/lwshell/lwshell_opts_template.h ${LWSHELL_OPTS_DIR}/lwshell_opts.h COPYONLY)
|
||||||
|
endif()
|
Loading…
x
Reference in New Issue
Block a user