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

library integration with fetch_content throws at submodule update #1099

Closed
Alex-dev02 opened this issue Nov 8, 2022 · 5 comments · Fixed by #1121
Closed

library integration with fetch_content throws at submodule update #1099

Alex-dev02 opened this issue Nov 8, 2022 · 5 comments · Fixed by #1121

Comments

@Alex-dev02
Copy link

Alex-dev02 commented Nov 8, 2022

Hi! I tried to replicate the installation process from examples/fetch_content, but with a few modifications which I find nonrelatable to my problem (but if someone thinks they are necessary, I will update my issue, but all I have done was to modify the hierarchy of the folder a little bit).
When I try to run cmake configure, it throws the following error (I am running the build on windows 10 btw):

cmake ..
-- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.19044.
Microsoft (R) Build Engine version 17.2.1+52cd2da31 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

  Performing update step for 'sqliteorm-populate'
  HEAD is now at feb237d Merge pull request #1076 from fnc12/removed-has-dependent-rows
  fatal: No url found for submodule path 'tests/_deps/catch2-src' in .gitmodules
  CMake Error at C:/myproject/build/_deps/sqliteorm-subbuild/sqliteorm-populate-prefix/tmp/sqliteorm-populate-gitupdate.cmake:272 (execute_process):
    execute_process failed command indexes:
  
      1: "Child return code: 128"
  
  
  
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(245,5): error MSB8066: Custom build for 'C:\myproject\build\_deps\sqliteorm-subbuild\CMakeFiles\77adcca34d425fa652be5b2cbcacc50c\sqliteorm-populate-update.rule;C:\myproject\build\_deps\sqliteorm-subbuild\CMakeFiles\77adcca34d425fa652be5b2cbcacc50c\sqliteorm-populate-patch.rule;C:\myproject\build\_deps\sqliteorm-subbuild\CMakeFiles\77adcca34d425fa652be5b2cbcacc50c\sqliteorm-populate-configure.rule;C:\myproject\Desktop\Intrebator\build\_deps\sqliteorm-subbuild\CMakeFiles\77adcca34d425fa652be5b2cbcacc50c\sqliteorm-populate-build.rule;C:\myproject\build\_deps\sqliteorm-subbuild\CMakeFiles\77adcca34d425fa652be5b2cbcacc50c\sqliteorm-populate-install.rule;C:\myproject\build\_deps\sqliteorm-subbuild\CMakeFiles\77adcca34d425fa652be5b2cbcacc50c\sqliteorm-populate-test.rule;C:\myproject\build\_deps\sqliteorm-subbuild\CMakeFiles\fc6fab01aac355c7d3ea1e3a3b0496f2\sqliteorm-populate-complete.rule;C:\myproject\build\_deps\sqliteorm-subbuild\CMakeFiles\0ba4a3fce33ce475aeca1a1280dc576f\sqliteorm-populate.rule' exited with code 1. [C:\myproject\build\_deps\sqliteorm-subbuild\sqliteorm-populate.vcxproj]

CMake Error at C:/Program Files/CMake/share/cmake-3.22/Modules/FetchContent.cmake:1087 (message):
  Build step for sqliteorm failed: 1
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.22/Modules/FetchContent.cmake:1216:EVAL:2 (__FetchContent_directPopulate)
  C:/Program Files/CMake/share/cmake-3.22/Modules/FetchContent.cmake:1216 (cmake_language)
  C:/Program Files/CMake/share/cmake-3.22/Modules/FetchContent.cmake:1259 (FetchContent_Populate)
  db/dependencies/sqlite_orm/CMakeLists.txt:3 (FetchContent_MakeAvailable)


-- Configuring incomplete, errors occurred!

How may I fix it?

@fnc12
Copy link
Owner

fnc12 commented Nov 8, 2022

@Alex-dev02 dunno. I need help of folks here

@Alex-dev02
Copy link
Author

@Alex-dev02 dunno. I need help of folks here

Also, sorry for bothering. I know this is not related to this issue, but what else do I have to do in order to use the library along with cmake and find_package, beside adding sqlite3 to path?

@fnc12
Copy link
Owner

fnc12 commented Nov 8, 2022

Actually I don't know how find_package works cause I am not a cmake pro. Most people usually use conan, vcpkg, cmake without find_package or manual including single header

@fnc12
Copy link
Owner

fnc12 commented Nov 8, 2022

https://stackoverflow.com/a/41642102/1927176 point 2 from here looks perfect for your case and doesn't use find_package

@trueqbit trueqbit linked a pull request Mar 9, 2023 that will close this issue
@trueqbit
Copy link
Collaborator

trueqbit commented Mar 9, 2023

@Alex-dev02 As for your other question how to use sqlite_orm with cmake.

First of all, you can of course use a C++ library package manager like vcpkg, and take it from there.

Otherwise, when you build and install sqlite_orm, packaging/CMakeLists.txt copies cmake/SqliteOrmConfig.cmake.in to cmake's package directory. Then it should be just a matter of using the right targets.
I recommend reading the readme, and taking a look at the 'find package' and 'fetch content' examples.

This is the output of vcpkg after installing the sqlite-orm port:

sqlite-orm provides CMake targets:

    # this is heuristically generated, and may not be correct
    find_package(SqliteOrm CONFIG REQUIRED)
    target_link_libraries(main PRIVATE sqlite_orm::sqlite_orm)

BTW, there's also great documentation available on how finding packages works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants