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 missing pugixml dependency in generated CMake package file #38

Merged
merged 1 commit into from
Aug 2, 2023

Conversation

myd7349
Copy link
Contributor

@myd7349 myd7349 commented Jul 31, 2023

libxdf depends on pugixml, but this dependency is missing in the generated CMake package file. As a result, users must have this in their CMakeLists.txt:

find_package(libxdf CONFIG REQUIRED)
find_package(pugixml CONFIG REQUIRED) # This line is necessary as `pugixml` dependency is missing in the generated CMake package files
add_executable(demo PRIVATE XDF::xdf)

With this patch, the users of libxdf do not need to handle pugixml dependency by themselves:

find_package(libxdf CONFIG REQUIRED)
add_executable(demo PRIVATE XDF::xdf)

And this pattern has been adopted by many widely used libraries like:

libxdfConfig.cmake.in Outdated Show resolved Hide resolved
@myd7349 myd7349 marked this pull request as ready for review August 1, 2023 13:40
@Yida-Lin
Copy link
Member

Yida-Lin commented Aug 2, 2023

Thanks! Some of the workflow did not go through; could you please help take a look.

@dg0yt
Copy link

dg0yt commented Aug 2, 2023

These errors seem unrelated to the PR, failing already at CMake project(...) (toolchain setup).

2023-08-02T07:32:01.0011600Z CMake Error at CMakeLists.txt:4 (project):
2023-08-02T07:32:01.0012612Z   Failed to run MSBuild command:
2023-08-02T07:32:01.0013665Z -- Configuring incomplete, errors occurred!
2023-08-02T07:32:01.0014135Z 
2023-08-02T07:32:01.0014685Z     C:/Program Files/Microsoft Visual Studio/2022/Enterprise/MSBuild/Current/Bin/amd64/MSBuild.exe
2023-08-02T07:32:01.0015164Z 
2023-08-02T07:32:01.0015717Z   to get the value of VCTargetsPath:
2023-08-02T07:32:01.0017372Z 
2023-08-02T07:32:01.0017649Z     MSBuild version 17.6.3+07e294721 for .NET Framework
2023-08-02T07:32:01.0018507Z     Build started 8/2/2023 7:31:52 AM.
2023-08-02T07:32:01.0019014Z     
2023-08-02T07:32:01.0019646Z     Project "D:\a\libxdf\libxdf\build\CMakeFiles\3.27.0\VCTargetsPath.vcxproj" on node 1 (default targets).
2023-08-02T07:32:01.0021742Z     C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(456,5): error MSB8020: The build tools for Visual Studio 2015 (Platform Toolset = 'v140') cannot be found. To build using the v140 build tools, please install Visual Studio 2015 build tools.  Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution". [D:\a\libxdf\libxdf\build\CMakeFiles\3.27.0\VCTargetsPath.vcxproj]
2023-08-02T07:32:01.0023484Z     Done Building Project "D:\a\libxdf\libxdf\build\CMakeFiles\3.27.0\VCTargetsPath.vcxproj" (default targets) -- FAILED.
2023-08-02T07:32:01.0024065Z     
2023-08-02T07:32:01.0024483Z     Build FAILED.
2023-08-02T07:32:01.0024919Z     
2023-08-02T07:32:01.0025587Z     "D:\a\libxdf\libxdf\build\CMakeFiles\3.27.0\VCTargetsPath.vcxproj" (default target) (1) ->
2023-08-02T07:32:01.0026230Z     (PrepareForBuild target) -> 
2023-08-02T07:32:01.0028024Z       C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(456,5): error MSB8020: The build tools for Visual Studio 2015 (Platform Toolset = 'v140') cannot be found. To build using the v140 build tools, please install Visual Studio 2015 build tools.  Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution". [D:\a\libxdf\libxdf\build\CMakeFiles\3.27.0\VCTargetsPath.vcxproj]
2023-08-02T07:32:01.0029244Z     
2023-08-02T07:32:01.0029671Z         0 Warning(s)
2023-08-02T07:32:01.0030305Z         1 Error(s)
2023-08-02T07:32:01.0030672Z     
2023-08-02T07:32:01.0031100Z     Time Elapsed 00:00:08.67
2023-08-02T07:32:01.0031544Z     
2023-08-02T07:32:01.0031831Z 
2023-08-02T07:32:01.0032029Z   Exit code: 1

@Yida-Lin Yida-Lin merged commit 524c37f into xdf-modules:main Aug 2, 2023
3 of 5 checks passed
@Yida-Lin
Copy link
Member

Yida-Lin commented Aug 2, 2023

Sounds good, thanks @myd7349 and @dg0yt !

@myd7349 myd7349 deleted the improve-cmake-package branch August 2, 2023 12:50
@myd7349 myd7349 mentioned this pull request Aug 2, 2023
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.

3 participants