mirror of
https://github.com/zekexiao/pocketlang.git
synced 2025-03-04 05:05:57 +08:00
Add CMakeLists.txt
This commit is contained in:
parent
e316d53fa7
commit
8c8b87a8f4
31
CMakeLists.txt
Normal file
31
CMakeLists.txt
Normal file
@ -0,0 +1,31 @@
|
||||
# Copyright (c) 2020-2021 Thakee Nathees
|
||||
# Distributed Under The MIT License
|
||||
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
project(pocket C)
|
||||
|
||||
set(POCKET_SRC_DIRS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/core
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/libs
|
||||
)
|
||||
|
||||
file(GLOB POCKET_SOURCES "")
|
||||
foreach(POCKET_SRC_DIR ${POCKET_SRC_DIRS})
|
||||
file(GLOB SOURCES "${POCKET_SRC_DIR}/*.c")
|
||||
list(APPEND POCKET_SOURCES ${SOURCES})
|
||||
endforeach()
|
||||
|
||||
add_library(${PROJECT_NAME} ${POCKET_SOURCES})
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/include)
|
||||
if(NOT MSVC)
|
||||
target_link_libraries(${PROJECT_NAME} m dl)
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE -fPIC)
|
||||
endif()
|
||||
|
||||
# if pocket is top level proejct build cli
|
||||
if(${PROJECT_NAME} STREQUAL ${CMAKE_PROJECT_NAME})
|
||||
add_executable(${PROJECT_NAME}cli ${CMAKE_SOURCE_DIR}/cli/main.c)
|
||||
target_link_libraries(${PROJECT_NAME}cli ${PROJECT_NAME})
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user