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

Fix building issue on vcpkg #416

Closed
wants to merge 1 commit into from
Closed

Conversation

Nukoooo
Copy link
Contributor

@Nukoooo Nukoooo commented Dec 20, 2023

I guess you forgot to add BUILD_TESTING check when making this change :^)

@jmigual
Copy link
Collaborator

jmigual commented Dec 21, 2023

Hi @Nukoooo I don't think I forgot. This is on purpose so the tests are build by default if this is the main project, i.e., if it's not an imported project. This code is extracted from the examples of the modern CMake book (https://gitlab.com/CLIUtils/modern-cmake/-/blob/master/examples/extended-project/CMakeLists.txt).

Why do you think it's an issue?

@Nukoooo
Copy link
Contributor Author

Nukoooo commented Dec 21, 2023

Because I was trying to update the library in vcpkg with commit 0dc2f7a, and it threw this error:

CMake Error at test/CMakeLists.txt:13 (target_link_libraries):
  Target "sio_test" links to:

    Catch2::Catch2WithMain

From what I understand is that vcpkg pulls the source code and builds it as a main project, which passes the CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME, hence the error is thrown. Currently I can't think of a better way to fix tihs problem but adding BUILD_TEST check

@Nukoooo
Copy link
Contributor Author

Nukoooo commented Jan 20, 2024

Closing as someone created this PR microsoft/vcpkg#36226

@Nukoooo Nukoooo closed this Jan 20, 2024
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