Refactor of CMake for cleaner dependency handling

This commit is contained in:
Jack Andersen 2019-06-11 15:54:20 -10:00
parent 77013bbd9f
commit 47322b9496
3 changed files with 12 additions and 12 deletions

View File

@ -1,8 +1,8 @@
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
cmake_minimum_required(VERSION 3.10 FATAL_ERROR) # because of c++17 cmake_minimum_required(VERSION 3.10 FATAL_ERROR) # because of c++17
project(nod VERSION 0.1) project(nod VERSION 0.1)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif() endif()
include (CMakePackageConfigHelpers) include (CMakePackageConfigHelpers)
@ -15,14 +15,13 @@ endif()
if (NOT TARGET logvisor) if (NOT TARGET logvisor)
add_subdirectory(logvisor) add_subdirectory(logvisor)
set(LOGVISOR_INCLUDE_DIR logvisor/include)
endif() endif()
include_directories(include ${LOGVISOR_INCLUDE_DIR})
file(GLOB NOD_HEADERS include/nod/*.h*) file(GLOB NOD_HEADERS include/nod/*.h*)
add_subdirectory(lib) add_subdirectory(lib)
add_subdirectory(driver) add_subdirectory(driver)
target_include_directories(nod PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
install(DIRECTORY include/nod DESTINATION include) install(DIRECTORY include/nod DESTINATION include)
set(version_config_file "${PROJECT_BINARY_DIR}/nodConfigVersion.cmake") set(version_config_file "${PROJECT_BINARY_DIR}/nodConfigVersion.cmake")

View File

@ -16,8 +16,9 @@ add_library(nod
nod.cpp nod.cpp
${PLAT_SRCS} ${PLAT_SRCS}
${NOD_HEADERS}) ${NOD_HEADERS})
target_link_libraries(nod PUBLIC logvisor)
if(NOT MSVC AND NOT NX) if(NOT MSVC AND NOT NX)
set_source_files_properties(aes.cpp PROPERTIES COMPILE_FLAGS -maes) set_source_files_properties(aes.cpp PROPERTIES COMPILE_FLAGS -maes)
endif() endif()
# Associate target with export # Associate target with export

@ -1 +1 @@
Subproject commit ebe7463e671388902e56084453a464e35389324a Subproject commit a0ef17d895ba655ade171f76a984663639a1d390