Skip to content

Commit

Permalink
[globle] change directory architecture
Browse files Browse the repository at this point in the history
  • Loading branch information
yangli committed Sep 16, 2022
1 parent 0242eac commit fce7c31
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions include/CMakeLists.txt → library/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ include(../cmake/CPM.cmake)
# PackageProject.cmake will be used to make our target installable
CPMAddPackage("gh:TheLartians/[email protected]")

find_package(Boost REQUIRED)
find_package(Boost REQUIRED COMPONENTS system iostreams)

# ---- Add source files ----

# Note: globbing sources is considered bad practice as CMake's generators may not detect new files
# automatically. Keep that in mind when changing files, or explicitly mention them here.
file(GLOB_RECURSE headers CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/../include/*.hpp")
file(GLOB_RECURSE sources CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/../source/*.cpp")
file(GLOB_RECURSE headers CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp")
file(GLOB_RECURSE sources CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp")

# ---- Create library ----

Expand All @@ -53,10 +53,10 @@ set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 20)
target_compile_options(${PROJECT_NAME} PUBLIC "$<$<COMPILE_LANG_AND_ID:CXX,MSVC>:/permissive->")

# Link dependencies
target_link_libraries(${PROJECT_NAME} PUBLIC spdlog::spdlog Boost::boost boost_iostreams)
target_link_libraries(${PROJECT_NAME} PUBLIC spdlog::spdlog Boost::boost Boost::iostreams)

target_include_directories(
${PROJECT_NAME} PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/../include>
${PROJECT_NAME} PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include/${PROJECT_NAME}-${PROJECT_VERSION}>
)

Expand All @@ -72,7 +72,7 @@ packageProject(
VERSION ${PROJECT_VERSION}
NAMESPACE ${PROJECT_NAME}
BINARY_DIR ${PROJECT_BINARY_DIR}
INCLUDE_DIR .
INCLUDE_DIR include
INCLUDE_DESTINATION include/${PROJECT_NAME}-${PROJECT_VERSION}
VERSION_HEADER "${VERSION_HEADER_LOCATION}"
COMPATIBILITY SameMajorVersion
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion source/fq_utils.cpp → library/source/fq_utils.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

#include <boss/fq_utils.hpp>
#include "boss/fq_utils.hpp"

namespace boss::fqsp {} // namespace boss::fqsp
2 changes: 1 addition & 1 deletion standalone/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ CPMAddPackage(
OPTIONS "CXXOPTS_BUILD_EXAMPLES NO" "CXXOPTS_BUILD_TESTS NO" "CXXOPTS_ENABLE_INSTALL YES"
)

CPMAddPackage(NAME BOSS SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../include)
CPMAddPackage(NAME BOSS SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../library")

# ---- Create standalone executable ----

Expand Down
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ CPMAddPackage("gh:TheLartians/[email protected]")
if(TEST_INSTALLED_VERSION)
find_package(boss REQUIRED)
else()
CPMAddPackage(NAME boss SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../include)
CPMAddPackage(NAME boss SOURCE_DIR ../library/include)
endif()

# ---- Create binary ----
Expand Down

0 comments on commit fce7c31

Please sign in to comment.