43 lines
1.0 KiB
CMake
43 lines
1.0 KiB
CMake
cmake_minimum_required(VERSION 3.6)
|
|
|
|
set(PROJECT_N hello)
|
|
|
|
|
|
project(${PROJECT_N} VERSION 1.0)
|
|
|
|
set(CMAKE_CXX_STANDARD 11)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
|
|
|
|
|
|
|
|
|
file(GLOB_RECURSE SRCS ${PROJECT_SOURCE_DIR}/src/*.cpp)
|
|
|
|
# a macro that gets all of the header containing directories.
|
|
MACRO(header_directories return_list includes_base_folder extention )
|
|
FILE(GLOB_RECURSE new_list ${includes_base_folder}/*.${extention})
|
|
SET(dir_list "")
|
|
FOREACH(file_path ${new_list})
|
|
GET_FILENAME_COMPONENT(dir_path ${file_path} PATH)
|
|
SET(dir_list ${dir_list} ${dir_path})
|
|
ENDFOREACH()
|
|
LIST(REMOVE_DUPLICATES dir_list)
|
|
SET(${return_list} ${dir_list})
|
|
ENDMACRO()
|
|
|
|
# using said macro.
|
|
header_directories(INCLUDES ${PROJECT_SOURCE_DIR}/include/ hpp)
|
|
|
|
message("src files:")
|
|
foreach(file ${SRCS})
|
|
message(STATUS ${file})
|
|
endforeach()
|
|
|
|
message("include directories:")
|
|
foreach(dir ${INCLUDES})
|
|
message(STATUS ${dir})
|
|
endforeach()
|
|
add_executable(${PROJECT_N} ${SRCS})
|
|
|
|
target_include_directories(${PROJECT_N} PUBLIC include)
|