Giter Site home page Giter Site logo

Comments (4)

memsharded avatar memsharded commented on July 20, 2024

Hi @atvise !

first of all I want to thank you for conan, it's an unbelievable life saver and awesome product ;) !

Thanks for your kind words :)

I am not sure about your syntax, as stated in http://docs.conan.io/en/latest/reference/conanfile/methods.html#package-info, the defines are a list of definitions. I would expect your definition to be something like:

self.cpp_info.defines= ['MY_DEF="My string"']

Could you please check it?

Recently some support for escaping cmake strings was added in: https://github.com/conan-io/conan/pull/2555/files, maybe it has to be be somehow extended to defines too.

from cmake-conan.

 avatar commented on July 20, 2024

Hi @memsharded,

I would expect your definition to be something like:

Sry my bad i'm actually already using this syntax. I've had written this issue out of my memory.
That means the mentioned problems still nevertheless occur.

Thx for your help!

from cmake-conan.

memsharded avatar memsharded commented on July 20, 2024

I have done a small test, with a "Tool" conanfile.py containing:

    def package_info(self):
        self.cpp_info.defines= ['MY_DEF="My string"', 'MY_DEF2="My other string"']

And then a "Hello" package depending on "Tool" with a library containing source code:

#include <iostream>
#include "hello.h"
#define STRINGIFY(x) #x
#define STRINGIFYMACRO(y) STRINGIFY(y)

void hello(){
    std::cout << "Msg1: " << STRINGIFYMACRO(MY_DEF) << "\n";
    std::cout << "Msg2: " << STRINGIFYMACRO(MY_DEF2) << "\n";
}

It works well, the conanbuildinfo contains:

set(CONAN_DEFINES_TOOL -DMY_DEF="My string"
			-DMY_DEF2="My other string")
# COMPILE_DEFINITIONS are equal to CONAN_DEFINES without -D, for targets
set(CONAN_COMPILE_DEFINITIONS_TOOL MY_DEF="My string"
			MY_DEF2="My other string")

Which seems to parse well, and the test application build and runs successfully:

Msg1: "My string"
Msg2: "My other string"

Now I see the issue. The thing is that you would like to have those strings without the extra quotes. Yes, confirmed this is an issue, will try to solve it. Thanks for the feedback!

from cmake-conan.

memsharded avatar memsharded commented on July 20, 2024

Ey, but this is an issue for conan, not for cmake-conan! :)

I will move the issue there.

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.