Skip to content

Commit

Permalink
Don't bother making the CMakeLists.txt usable by end-users.
Browse files Browse the repository at this point in the history
This allows us to avoid having to offer two build targets - one for libscran
developers (without the 'scran/' nesting) and one for end-users.
  • Loading branch information
LTLA committed Jun 24, 2024
1 parent 6223f48 commit 572c9b7
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 14 deletions.
6 changes: 1 addition & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,11 @@ project(scran_utils

add_library(scran_core_utils INTERFACE)
target_compile_features(scran_core_utils INTERFACE cxx_std_17)
target_include_directories(scran_core_utils INTERFACE include)
target_include_directories(scran_core_utils INTERFACE include/scran)

if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
include(CTest)
if(BUILD_TESTING)
add_subdirectory(tests)
endif()
endif()

add_library(scran_core_utils_internal INTERFACE)
target_compile_features(scran_core_utils_internal INTERFACE cxx_std_17)
target_include_directories(scran_core_utils_internal INTERFACE include/scran)
8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ or `EQUAL`, where all blocks are equally weighted regardless of size (assuming t

This repository is part of the broader [**libscran**](https://github.com/libscran/libscran) library,
so users are recommended to use the latter in their projects.
Nonetheless, if this library is to be used directly, we can use CMake with `FetchContent`:
**libscran** developers should just use CMake with `FetchContent`:

```cmake
include(FetchContent)
Expand All @@ -105,16 +105,10 @@ FetchContent_Declare(
)
FetchContent_MakeAvailable(scran_core_utils)
```

Then we can link to `scran_core_utils` to make the headers available during compilation:
```cmake
# For executables:
target_link_libraries(myexe scran_core_utils)
# For libaries
target_link_libraries(mylib INTERFACE scran_core_utils)
```

If you're not using CMake, the simple approach is to just copy the files in `include/` - either directly or with Git submodules - and include their path during compilation with, e.g., GCC's `-I`.
2 changes: 1 addition & 1 deletion tests/src/average_vectors.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <gtest/gtest.h>
#include "scran/average_vectors.hpp"
#include "average_vectors.hpp"
#include "compare_almost_equal.h"
#include <vector>

Expand Down
2 changes: 1 addition & 1 deletion tests/src/block_weights.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <gtest/gtest.h>
#include "scran/block_weights.hpp"
#include "block_weights.hpp"
#include <vector>

TEST(BlockWeights, Variable) {
Expand Down

0 comments on commit 572c9b7

Please sign in to comment.