Created
April 7, 2019 14:50
-
-
Save an-dr/771f2681dd9d48f011713dae04584048 to your computer and use it in GitHub Desktop.
CMakeLists.txt - nested source directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set(PROJECT_NAME libhello) | |
set(PROJECT_INCLUDES inc_deps include) | |
set(PROJECT_SRC src/hello.cpp) | |
cmake_minimum_required(VERSION 3.0) | |
set(CMAKE_CXX_STANDARD 14) | |
project(${PROJECT_NAME} LANGUAGES CXX) | |
# exports ============================================================================================================== | |
foreach (inc_dir ${PROJECT_INCLUDES}) | |
set(${PROJECT_NAME}_INCLUDES ${${PROJECT_NAME}_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR}/${inc_dir}) | |
endforeach(inc_dir) | |
foreach (src ${PROJECT_SRC}) | |
set(${PROJECT_NAME}_SRC ${${PROJECT_NAME}_SRC} ${CMAKE_CURRENT_SOURCE_DIR}/${src}) | |
endforeach(src) | |
set(${PROJECT_NAME}_INCLUDES ${${PROJECT_NAME}_INCLUDES} PARENT_SCOPE) | |
set(${PROJECT_NAME}_SRC ${${PROJECT_NAME}_SRC} PARENT_SCOPE) | |
# exports ============================================================================================================== | |
include_directories(${PROJECT_INCLUDES}) | |
message(STATUS "== => ${PROJECT_NAME} is loaded") | |
message(STATUS " Exported ${PROJECT_NAME}_INCLUDES: ${${PROJECT_NAME}_INCLUDES}") | |
message(STATUS " Exported ${PROJECT_NAME}_SRC: ${${PROJECT_NAME}_SRC}") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment