Giter Club home page Giter Club logo

Comments (9)

Lucaslah avatar Lucaslah commented on August 18, 2024 1

I was successful to build using FetchContent, but I have discovered another bug.

For now, remove find_package and disable TOM.

Something like this:

FetchContent_Declare(TinyOrm 
    GIT_REPOSITORY https://github.com/silverqx/TinyORM.git
    GIT_TAG origin/main
)
set(TOM OFF)
FetchContent_MakeAvailable(TinyOrm)

...

target_link_libraries(${PROJECT_NAME}
    PRIVATE
        Qt${QT_VERSION_MAJOR}::Core
        TinyOrm::TinyOrm
)

That are good news though grin, that bug looks simply fixable, I look at it later.

This worked for me, thanks very much.

from tinyorm.

silverqx avatar silverqx commented on August 18, 2024

The problem obviously is with the FetchContent_Declare/MakeAvailable, I'm setting properties on the alias TinyOrm::TinyOrm inside the TinyOrmConfig.cmake:75 and it normally works when you try to build TinyOrm without these FetchContent_ CMake functions.

I have never used/tried these FetchContent_ functions. The CMake build will have to be fixed to make this work.

So I have played a little with it and the problem is that the TinyOrmTargets.cmake file is not exported and I don't know why.

Anyway, you can't build with these FetchContent_ functions, it simply doesn't work and have to be fixed.

from tinyorm.

silverqx avatar silverqx commented on August 18, 2024

I think this can be related link or a very similar problem, or this. I don't understand how FetchContent works so I can't tell. It looks like you have to install the target that was FetchContent_MakeAvailable(TinyORM).

It looks like this doesn't work out of the box (maybe it works only for the header-only libraries and not for libraries that need to be compiled?):

FetchContent_Declare(TinyOrm
    GIT_REPOSITORY https://github.com/silverqx/TinyORM.git
    GIT_TAG origin/main
)
FetchContent_MakeAvailable(TinyOrm)

from tinyorm.

silverqx avatar silverqx commented on August 18, 2024

I was successful to build using FetchContent, but I have discovered another bug.

For now, remove find_package and disable TOM.

Something like this:

FetchContent_Declare(TinyOrm 
    GIT_REPOSITORY https://github.com/silverqx/TinyORM.git
    GIT_TAG origin/main
)
set(TOM OFF)
FetchContent_MakeAvailable(TinyOrm)

...

target_link_libraries(${PROJECT_NAME}
    PRIVATE
        Qt${QT_VERSION_MAJOR}::Core
        TinyOrm::TinyOrm
)

That are good news though 😁, that bug looks simply fixable, I look at it later.

from tinyorm.

silverqx avatar silverqx commented on August 18, 2024

I have already pushed fixes, currently are running CI pipelines, I'm going to make a release, I post an update here afterward.

from tinyorm.

Lucaslah avatar Lucaslah commented on August 18, 2024

Alright sounds good.

from tinyorm.

silverqx avatar silverqx commented on August 18, 2024

I have pushed a new release that contains a fix, you can look here what was the fix about.

from tinyorm.

silverqx avatar silverqx commented on August 18, 2024

A few words about the FetchContent, the FetchContent_Declare() it's like git clone inside the build folder and then add the cloned folder in a similar way like add_subdirectory(<cloned_folder>) does and the FetchContent_MakeAvailable(<package>) internally calls the find_package(<package>) or if you define OVERRIDE_FIND_PACKAGE then you don't have to call the the FetchContent_MakeAvailable() and you must call the find_package(<package> x.y.z CONFIG REQUIRED) manually.
An advantage of the OVERRIDE_FIND_PACKAGE is that you can call it much later and you can insert configurations between.

So you can include the TinyORM like this:

set(FETCHCONTENT_QUIET OFF)
include(FetchContent)
FetchContent_Declare(TinyOrm
    GIT_REPOSITORY https://github.com/silverqx/TinyORM.git
    GIT_TAG        origin/main
)
# Here you can configure TinyORM CMake options
set(MYSQL_PING ON)
set(TOM_EXAMPLE ON)
FetchContent_MakeAvailable(TinyOrm)

...

target_link_libraries(${PROJECT_NAME}
    PRIVATE
        Qt${QT_VERSION_MAJOR}::Core
        TinyOrm::TinyOrm
)

or like this:

set(FETCHCONTENT_QUIET OFF)
include(FetchContent)
FetchContent_Declare(TinyOrm
    GIT_REPOSITORY https://github.com/silverqx/TinyORM.git
    GIT_TAG        origin/main
    OVERRIDE_FIND_PACKAGE
)
# Here you can configure TinyORM CMake options
set(MYSQL_PING ON)
set(TOM_EXAMPLE ON)

...

find_package(TinyOrm 0.16.0 CONFIG REQUIRED)
target_link_libraries(${PROJECT_NAME}
    PRIVATE
        Qt${QT_VERSION_MAJOR}::Core
        TinyOrm::TinyOrm
)

Maybe it helps someone in the future 😎

from tinyorm.

silverqx avatar silverqx commented on August 18, 2024

I have also added docs for the FetchContent method in HelloWorld docs example here.

I think it should be all πŸ•Ί

from tinyorm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.