Merge pull request #2 from TimothyHelton/feature/add_src

ENH: add source files
This commit is contained in:
Timothy Helton 2017-12-28 11:19:41 -07:00 committed by GitHub
commit c7eff7e6b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 0 deletions

13
CMakeLists.txt Normal file
View File

@ -0,0 +1,13 @@
cmake_minimum_required(VERSION 3.9)
project(MyProject)
set(CMAKE_CXX_STANDARD 17)
set(SOURCE_FILES main.cpp)
add_executable(${CMAKE_PROJECT_NAME}_run ${SOURCE_FILES})
include_directories(src)
add_subdirectory(src)
target_link_libraries(${CMAKE_PROJECT_NAME}_run ${CMAKE_PROJECT_NAME}_lib)

3
main.cpp Normal file
View File

@ -0,0 +1,3 @@
int main() {
return 0;
}

17
src/CMakeLists.txt Normal file
View File

@ -0,0 +1,17 @@
project(${CMAKE_PROJECT_NAME}_lib)
set(HEADER_FILES
)
set(SOURCE_FILES
)
if (EXISTS ${SOURCE_FILES})
# The library contains header and source files.
add_library(${CMAKE_PROJECT_NAME}_lib STATIC
${SOURCE_FILES}
${HEADER_FILES}
)
else()
# The library only contains header files.
add_library(${CMAKE_PROJECT_NAME}_lib INTERFACE)
endif()