Coder Social home page Coder Social logo

Comments (8)

Boris-Rasin avatar Boris-Rasin commented on May 20, 2024

Thank you for reporting this.

Is your project available on github?

If not, can you please post skeleton CMake files, so I can setup the test project?

from scapix.

Boris-Rasin avatar Boris-Rasin commented on May 20, 2024

I tried to recreate your setup, here:

https://github.com/scapix-com/bug_multilevel

However, I do not get the error, everything works fine.

I gave you write access to this repository, can you please add necessary modifications to get the error?

Thanks.

from scapix.

TimPushkin avatar TimPushkin commented on May 20, 2024

I managed to recreate the error and commited it to the repository. It represents the current state of my project: if I use CMake 3.18 then the errors described above appear, if I use CMake 3.20 or higher then the configuration completes without errors, but build fails because the bridge file for SomeClass.cpp doesn't get generated and thus cannot be found.

from scapix.

Boris-Rasin avatar Boris-Rasin commented on May 20, 2024

Thanks, I found that simply setting cmake_minimum_required(VERSION 3.18) in my original test leads to error.

Starting from CMake 3.20 the error disappears because of this change in CMake 3.20:
https://cmake.org/cmake/help/latest/prop_sf/GENERATED.html

There is a workaround in Scapix using older CMake: when linking lib from another CMake file, call scapix_fix_sources(lib):

add_executable(example example.cpp)
target_link_libraries(example lib)
scapix_fix_sources(lib)

Please tell me if this workaround is good enough for your use case.

from scapix.

TimPushkin avatar TimPushkin commented on May 20, 2024

Yes, it works, thanks. But in my project I do not always build examples, so the corresponding CMake file gets skipped, scapix_fix_sources() doesn't get called, and I get the same error with add_library as described above (in my project Scapix is configured outside of the file where add_library is, just like in the example project I commited).

Is there a place where I can find any documentation about scapix_fix_sources()? If I add some new example targets into the same example/CMakeLists.txt do I call this command after each new target, or do I call it only after the last one in the file? If I add new targets linking lib in some other file do I call the command again or do I call it after all of the targets that link lib in the project are added? Can I just put it at the bottom of my top level CMake file and use it even when no other targets apart from the library is present?

from scapix.

Boris-Rasin avatar Boris-Rasin commented on May 20, 2024

Turns out there were multiple issues affecting the situation when add_library and scapix_bridge_headers are called from different directories.

I submitted a fix, and now it should work correctly with CMake 3.18 or later (there is still an issue with CMake older then 3.18).

All you need in your case is a single call to scapix_fix_sources(lib) in every CMake file where lib is used, even if it's used multiple times in the same CMake file (but there is no harm in calling it multiple times). It should work now even if all these CMake files are skipped.

I will release new Scapix version soon.

from scapix.

Boris-Rasin avatar Boris-Rasin commented on May 20, 2024

Fixed in cmodule v1.0.34:

https://github.com/scapix-com/cmodule/releases

from scapix.

TimPushkin avatar TimPushkin commented on May 20, 2024

Can confirm that I no longer have these configure time errors with v1.0.34, thanks

from scapix.

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.