question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CONAN_EXPORTED variable in CMake

See original GitHub issue

Acording to the docs: http://docs.conan.io/en/latest/changelog.html?highlight=conan_exported the CMake variable CONAN_EXPORT should be set when running conan create, and not set when running conan build. The documentation is actually non existant for this variable and the only mention is in the changelog, saying on version 0.19.0:

Feature: new cmake CONAN_EXPORTED variable, can be used in CMakeLists.txt to differentiate building in the local conan cache as package and building in user space

From my tests I see that the variable is set in both scenarios. I’ve tested this with Conan 1.0.4. Please let me know if I’m using this wrong.

I’m testing it like this:

if(CONAN_EXPORTED) # set when running "conan build"
    message("=================================== CONAN_EXPORT is set: ${CONAN_EXPORT}")
else()
    message("=================================== CONAN_EXPORT is not set: ${CONAN_EXPORT}")
endif()

In both scenarios the output is:

=================================== CONAN_EXPORT is set:

To help us debug your issue please explain:

  • I’ve read the CONTRIBUTING guide.
  • I’ve specified the Conan version, operating system version and any tool that can be relevant.
  • I’ve explained the steps to reproduce the error or the motivation/use case of the question/suggestion.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
madpipelinecommented, Feb 6, 2018

Yes, that is the differentiation I wanted to make. I can now set a variable myself, now that I know of conanfile.in_local_cache. I’ll test this one now.

1reaction
lasotecommented, Feb 6, 2018

Maybe we could create a new variable in CMake to follow the conanfile.in_local_cache. Is that the differentiation you want to make?

http://docs.conan.io/en/latest/reference/conanfile/attributes.html?highlight=in_local_cache#in-local-cache

Read more comments on GitHub >

github_iconTop Results From Across the Web

cmake — conan 1.53.0 documentation
It generates a file named conanbuildinfo.cmake and declares some variables and methods. Variables in conanbuildinfo.cmake¶. Package declared variables: For each ...
Read more >
cmake-variables(7) — CMake 3.25.1 Documentation
This page documents variables that are provided by CMake or have meaning to CMake when set by project code. For general information on...
Read more >
set — CMake 3.25.1 Documentation
Set a normal, cache, or environment variable to a given value. See the cmake-language(7) variables documentation for the scopes and interaction of normal ......
Read more >
CMAKE_<LANG>_COMPILER — CMake 3.25.1 Documentation
The full path to the compiler for LANG . This is the command that will be used as the <LANG> compiler. Once set,...
Read more >
if — CMake 3.25.1 Documentation
Named boolean constants are case-insensitive. If the argument is not one of these specific constants, it is treated as a variable or string...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found