Giter Site home page Giter Site logo

Full rebuild after cmake about cmake-conan HOT 4 CLOSED

conan-io avatar conan-io commented on July 20, 2024
Full rebuild after cmake

from cmake-conan.

Comments (4)

memsharded avatar memsharded commented on July 20, 2024

I am trying to figure out what could be happening but still no idea. I am working with a normal project (not using cmake-conan), with a conanbuildinfo.cmake, and re-launching project generation and project build, and it doesn't get fully rebuild.

These cmake quirks are quite annoying. What cmake version are you running? I have tried with 3.7. Do you have a fully reproducible behavior of this issue? Thanks!

from cmake-conan.

koliyo avatar koliyo commented on July 20, 2024

It does not rebuild for a small standalone example!

I have found the problem, it is a combination of the conan flag setting and our internal flag modifications. We have a macro to remove flags depending on cmake settings.

MACRO(AGX_REMOVE_CXX_FLAG flag)
  IF (CMAKE_CXX_FLAGS)
    STRING(REGEX REPLACE " *${flag}" "" CMAKE_CXX_FLAGS_TMP ${CMAKE_CXX_FLAGS})
    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_TMP}" CACHE STRING "" FORCE)
  ENDIF()
ENDMACRO()

Even if this does not change the flag string it modifies some internal cmake state. I have printed CMAKE_CXX_FLAGS before and after calling this macro and it has the same value. But still, this in combination with conan cmake flags will cause whitespace to appear. If I completely remove calls to either conan or AGX_REMOVE_CXX_FLAG then the problem disappear.

I have modifed our macro to only re-set the flags if the regex did some modification.

MACRO(AGX_REMOVE_CXX_FLAG flag)
  IF (CMAKE_CXX_FLAGS)
    STRING(REGEX REPLACE " *${flag}" "" CMAKE_CXX_FLAGS_TMP ${CMAKE_CXX_FLAGS})
    IF (NOT (CMAKE_CXX_FLAGS_TMP STREQUAL CMAKE_CXX_FLAGS))
      SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_TMP}" CACHE STRING "" FORCE)
    ENDIF()
  ENDIF()
ENDMACRO()

Now I don't see this problem any more.

from cmake-conan.

memsharded avatar memsharded commented on July 20, 2024

Great! Very glad you were able to fix it.
Definitely, the CMake quirks can be a nightmare sometimes. Thanks very much for reporting the solution.

from cmake-conan.

ilqvya avatar ilqvya commented on July 20, 2024

maybe it's better to fix it on cmake side so no one need to change their scripts ?...

from cmake-conan.

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.