Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add export targets and config file #283

Merged
merged 5 commits into from
Dec 21, 2023
Merged

Add export targets and config file #283

merged 5 commits into from
Dec 21, 2023

Conversation

cjh1
Copy link
Member

@cjh1 cjh1 commented May 4, 2023

This adds support for building against stempy, either a build tree or install tree.

@cjh1
Copy link
Member Author

cjh1 commented May 5, 2023

find_package(stempy REQUIRED)
target_link_libraries(test PRIVATE stempy::stem Python3::Python)

@cjh1 cjh1 force-pushed the export-targets branch from 0929640 to 9265b03 Compare May 31, 2023 13:42
cjh1 added 4 commits December 12, 2023 15:33
This supports external projects linking against stempy.
The clean up of includes in image.h revealed that these headers
were being included transitively.
@swelborn
Copy link
Collaborator

I was getting a bunch of strange warnings in my build after running:

cmake -DCMAKE_PREFIX_PATH=/path/to/stempy/build -B build indicating that /home/swelborn/gits/detstream/stempy
was not a file:

cc1: warning: /home/swelborn/gits/detstream/stempy: No such file or directory [-Wmissing-include-dirs]
cc1: warning: /home/swelborn/gits/detstream/stempy: No such file or directory [-Wmissing-include-dirs]

I tried to minimize my configuration to just find a couple packages including stempy:

cmake_minimum_required(VERSION 3.14...3.22)

# ---- Project ----

project(
  detstream
  VERSION 0.1
  LANGUAGES CXX
)

# ---- Required Dependencies ----

find_package(Threads REQUIRED)
find_package(Boost REQUIRED)
find_package(stempy REQUIRED)

get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
foreach(dir ${dirs})
  message(STATUS "dir='${dir}'")
endforeach()

This outputs:

-- dir='/home/swelborn/gits/detstream/stempy'
-- dir='/home/swelborn/gits/stempy/build'

Commenting out find_package(stempy REQUIRED) outputs nothing for the directories function.

Can you reproduce this?


find_package(Python3 REQUIRED COMPONENTS Development)

include_directories("${CMAKE_CURRENT_SOURCE_DIR}/stempy")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is where my issue is coming from. ${CMAKE_CURRENT_SOURCE_DIR} is not the same in the CMakeLists that imports. I removed both lines in a test branch here and things still work. I believe the targets should hold this information, right?

@cjh1
Copy link
Member Author

cjh1 commented Dec 19, 2023

@swelborn I have added an extra target include directory so that we can remove the include_directories(...) otherwise we would break building against an build tree.

@swelborn swelborn merged commit 0f0ae95 into master Dec 21, 2023
11 checks passed
@cjh1 cjh1 deleted the export-targets branch January 9, 2025 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants