Giter Site home page Giter Site logo

cmake-conan's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cmake-conan's Issues

Failure in conan_cmake_detect_vs_runtime if BUILD_TYPE argument is passed

conan_cmake_settings successfully handles the argument with the following code:

    if(ARGUMENTS_BUILD_TYPE)
        set(_SETTINGS ${_SETTINGS} -s build_type=${ARGUMENTS_BUILD_TYPE})
    elseif(CMAKE_BUILD_TYPE)
        set(_SETTINGS ${_SETTINGS} -s build_type=${CMAKE_BUILD_TYPE})
    else()
        message(FATAL_ERROR "Please specify in command line CMAKE_BUILD_TYPE (-DCMAKE_BUILD_TYPE=Release)")
    endif()

However, in conan_cmake_detect_vs_runtime only checks against CMAKE_BUILD_TYPE and not ARGUMENTS_BUILD_TYPE so it fails to detect the runtime correctly, and therefore causes the script to fail:

    string(TOUPPER ${CMAKE_BUILD_TYPE} build_type)
    set(variables CMAKE_CXX_FLAGS_${build_type} CMAKE_C_FLAGS_${build_type} CMAKE_CXX_FLAGS CMAKE_C_FLAGS)

Wrong initial working directory

Hi,

I get this error when trying to generate a Visual Studio project via cmake-gui:

PROJECT: 
Generated cmake created conanbuildinfo.cmake

PROJECT: 
ERROR: Generator cmake(file:conanbuildinfo.cmake) failed
[Errno 13] Permission denied: 'C:\\Program Files\\CMake\\bin\\conanbuildinfo.cmake'

PROJECT: 
Generated cmake_multi created conanbuildinfo_multi.cmake

PROJECT: 
ERROR: Generator cmake_multi(file:None) failed
[Errno 13] Permission denied: 'C:\\Program Files\\CMake\\bin\\conanbuildinfo_multi.cmake'

Looks like conan.cmake runs conan install in the current working directory, instead of in the generator output directory.

Detects AppleClang as Clang

Per @sztomi...

-- The C compiler identification is AppleClang 8.1.0.8020042
-- The CXX compiler identification is AppleClang 8.1.0.8020042
-- Check for working C compiler: /Applications/Xcode_8.3.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode_8.3.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode_8.3.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode_8.3.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Downloading conan.cmake from https://github.com/memsharded/cmake-conan
-- Conan ** WARNING** : This detection of settings from cmake is experimental and incomplete. Please check 'conan.cmake' and contribute
-- Conan executing: conan install -f=/Users/tamas/src/libhandler-example/conanfile.py -g cmake -s build_type=Debug -s os=Macos -s compiler=clang -s compiler.version=8.1 -s compiler.libcxx=libstdc++ --build=missing
ERROR: Invalid setting '8.1' is not a valid 'settings.compiler.version' value.
Possible values are ['3.3', '3.4', '3.5', '3.6', '3.7', '3.8', '3.9', '4.0', '5.0']
Read "http://docs.conan.io/en/latest/faq/troubleshooting.html#error-invalid-setting"
CMake Error at build/conan.cmake:236 (message):
  Conan install failed='1'
Call Stack (most recent call first):
  build/conan.cmake:313 (conan_cmake_install)
  conan_include.cmake:10 (conan_cmake_run)
  CMakeLists.txt:4 (include)

Allow setting build type to conan_cmake_settngs and conan_cmake_run

In CMake, CMAKE_BUILD_TYPE is not restricted to ("Debug", "Release"), but it can have arbitrary string value, like RelWithDebInfo or DebugAsan or so on. Moreover, Conan profile can have various build_type by modifying settings.yml.

So it's a good idea to have the ability to set build_type in conan_cmake_settings and conan_cmake_run. I have a working patch for it, but I'll wait submit it until merging #70 since it is quite similar patches.

conan.cmake should be versioned

As a user I'd like to be able to download a versioned (e.g v0.5) conan.cmake file. If I'm always downloading from master the file I download may silently change between builds.

How to make set certain environment variables for the conan execution?

My issue is that I need to compile boost with BOOST_ASIO_NO_DEPRECATED but the official community conan package for boost 1.67 does not support setting this as an option. Is there a way for me to set this as an environment variable via conan_cmake_run()? I know I could use profiles by setting [env] and setting it in a profile but that feels like an overkill that I want to try and avoid.

Profile argument causes error.

If PROFILE or related arguments are passed to conan_cmake_run or conan_cmake_install, cmake-conan ignores all settings, including -g cmake, which makes this option unuseable with CMake integration.

set(settings -pr ${ARGUMENTS_PROFILE})

Following CMakeLists.txt is used with cmake-conan v0.11:

cmake_minimum_required(VERSION 3.4)
project(test_cmake_conan)

set(BUILD_CONAN_MISSING FALSE CACHE BOOL "Build missing packages")
set(BUILD_CONAN_PROFILE "" CACHE STRING "Use profile to overide the profile detection")
set(BUILD_CONAN_UPDATE FALSE CACHE BOOL "Check updates exist from upstream remote")

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/third_party/cmake")

include(conan)
if(BUILD_CONAN_MISSING)
    set(BUILD_CONAN_RULE "missing")
else()
    set(BUILD_CONAN_RULE "")
endif()

if(BUILD_CONAN_UPDATE)
    set(_BUILD_CONAN_UPDATE "UPDATE")
endif()

if(BUILD_CONAN_PROFILE)
    set(CONAN_DISABLE_CHECK_COMPILER True)
    set(_BUILD_CONAN_PROFILE PROFILE "${BUILD_CONAN_PROFILE}")
endif()

string(FIND "${CMAKE_BUILD_TYPE}" "Rel" REL_POS)
if(NOT(REL_POS LESS 0))
    set(_BUILD_CONAN_TYPE "Release")
else()
    set(_BUILD_CONAN_TYPE "Debug")
endif()

conan_cmake_run(
    CONANFILE conanfile.py
    BASIC_SETUP ${_BUILD_CONAN_UPDATE} CMAKE_TARGETS KEEP_RPATHS NO_OUTPUT_DIRS
    BUILD_TYPE ${_BUILD_CONAN_TYPE} ${_BUILD_CONAN_PROFILE}
    BUILD "${BUILD_CONAN_RULE}"
)

cmake /path/to/project -DBUILD_CONAN_PROFILE=default would print following errors:

$ cmake /path/to/project -DBUILD_CONAN_PROFILE='default'
-- The C compiler identification is GNU 5.4.1
-- The CXX compiler identification is GNU 5.4.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Conan ** WARNING** : This detection of settings from cmake is experimental and incomplete. Please check 'conan.cmake' and contribute
-- Conan executing: conan install /path/to/project/conanfile.py -pr default
Version range '>=1.2.11-5' required by 'None' resolved to 'zlib/1.2.11@leebc/stable'
boost/1.64.0-2@leebc/stable requirement zlib/[>=1.2.11-0]@leebc/stable overriden by your conanfile to zlib/1.2.11@leebc/stable 
Version range '>=1.2.11-0' required by 'boost/1.64.0-2@leebc/stable' valid for downstream requirement 'zlib/1.2.11@leebc/stable'
PROJECT: Installing /path/to/project/conanfile.py
Requirements
    boost/1.64.0-2@leebc/stable from 'local'
    zlib/1.2.11-6@leebc/stable from 'local'
Packages
    boost/1.64.0-2@leebc/stable:c52c6fdfc799449191f9eace0697eb6daf7afb80
    zlib/1.2.11-6@leebc/stable:d358fec34c04bcd89832a09158783c750a3304dc

zlib/1.2.11-6@leebc/stable: Already installed!
boost/1.64.0-2@leebc/stable: Already installed!
boost/1.64.0-2@leebc/stable: LIBRARIES: ['boost_container', 'boost_iostreams', 'boost_program_options', 'boost_random', 'boost_regex', 'boost_thread', 'boost_chrono', 'boost_atomic', 'boost_filesystem', 'boost_system', 'rt', 'pthread']
boost/1.64.0-2@leebc/stable: Package folder: /home/leebc/.conan/data/boost/1.64.0-2/leebc/stable/package/c52c6fdfc799449191f9eace0697eb6daf7afb80
PROJECT: Generator txt created conanbuildinfo.txt
PROJECT: Generated conaninfo.txt
CMake Error at third_party/cmake/conan.cmake:381 (message):
  conanbuildinfo.cmake doesn't exist in
  /path/to/project/cmake-build-debug
Call Stack (most recent call first):
  third_party/cmake/conan.cmake:409 (conan_load_buildinfo)
  CMakeLists.txt:33 (conan_cmake_run)


-- Configuring incomplete, errors occurred!
See also "/path/to/project/cmake-build-debug/CMakeFiles/CMakeOutput.log".

Passing extra arguments to `conan install`

Hi,

I am using a toolchain that requires me to pass extra arguments to conan install: conan install ... --profile <profile_filename>.

How do I make this happen with cmake-conan? I keep reading the source and going through the docs, but there seems to simply be no way? It would be great if conan_cmake_run() accepted a set of arguments that it just proxied, unmodified, to the conan install command.

Thanks,
Areg

conan_cmake_run fails when conan is installed locally (not system-wide)

CMake:

if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
    message(STATUS "Downloading conan.cmake from https://github.com/memsharded/cmake-conan")
    file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/master/conan.cmake"
            "${CMAKE_BINARY_DIR}/conan.cmake")
endif()

include(${CMAKE_BINARY_DIR}/conan.cmake)
conan_cmake_run(CONANFILE conanfile.txt  # or relative build/conanfile.txt
                BASIC_SETUP CMAKE_TARGETS
                BUILD missing)

Output:

-- Conan ** WARNING** : This detection of settings from cmake is experimental and incomplete. Please check 'conan.cmake' and contribute
-- Conan executing: conan install -f=/home/sztomi/Projects/MyCoolProject/conanfile.txt -g cmake -s build_type=Debug -s os=Linux -s compiler=gcc -s compiler.version=6.3 -s compiler.libcxx=libstdc++11 --build=missing
CMake Error at cmake-build-debug/conan.cmake:221 (message):
  Conan install failed='No such file or directory'
Call Stack (most recent call first):
  cmake-build-debug/conan.cmake:298 (conan_cmake_install)
  CMakeLists.txt:14 (conan_cmake_run)

However, when I run the same command from the command line, it works. Tried CMake 3.7 (bundled) and 3.8 with the same result.

Direct integration into cmake

Hey,

I like the idea to use cmake to control conan. Are there any chances to integrate that into cmake itself (in the long run), because kitware integrate many 3rdpart libs into cmake?

Greetings
Tonka

Multiple targets

Let's say I have two CMakeLists.txt files with one target each. All of them have conan dependency.
Conan will be launch twice?
Does it check dependency conflict?

License and other information inside the conan.cmake file

Hello there, I want to suggest you to write the license information at the top of the conan.cmake file because this file can be saved into people own repositories.
Also it is good idea to write after the license information what this file is for, it will help some developers to understand this file, for example when this file is auto-downloaded with cmake and a developer sees a new file in his repository he can just open it and read information what this file is for.
Thank you.

Production ready?

Hey everybody,

i want to start an disscussion about the production ready state from cmake-conan. I've use it alot in in my toy projects (and i don't wanna miss that tool). In my perspective it has some kind of production ready state already.
@memsharded How you see the production ready state?
What features are generally missing to be production ready (if that's the case)?

Greetings
Tonka

Cannot pass options ?

I'm using cmake-conan to obtain the library SDL2/2.0.5@lasote/stable. It works well, but as I was experimenting with options, like this:

conan_cmake_run(REQUIRES SDL2/2.0.5@lasote/stable
                OPTIONS shared=True
                BASIC_SETUP CMAKE_TARGETS
                BUILD missing)

, I got:

Conan executing: conan install -g cmake_multi -s build_type=Release -s os=Windows -s compiler=Visual Studio -s compiler.version=14 -s arch=x86 -s compiler.runtime=MD --build=missing
ERROR: 'options.shared' doesn't exist
Possible options are []

That's strange, because the recipe at https://conan.io/source/SDL2/2.0.5/lasote/stable defines possible options with the line:

options = {"directx": [True, False], "shared": [True, False], "fPIC": [True, False]}

Conan profile files from current CMake config

Is there any known way to conveniently generate a Conan profile file from the inside of a CMake config script, to use it directly from that same config a few commands later (by calling conan via execute_process()?)

BTW: can the Conan system/user config be viewed as a default profile? (So wouldn't it be more consistent to have all the default config, for example, in .conan/profiles/default file?)

BTW2: .conan/conan.conf, conanfile.txt, profile config files and the generated conaninfo.txt don't accept all same sections -- is there any rationale behind such limitation?

"ERROR: Conanfile not found!" in latest version (reason included)

Hello,

I tried to do a clean build and it was failing. I found that the error was in the latest version of conan.cmake. It crashes with the message:

ERROR: Conanfile not found!
CMake Error at cmake-build-debug/conan.cmake:265 (message):
  Conan install failed='1'

I did a diff on the files and found the change that broke my configuration.

Line 235 was changed from:

set(CONANFILE -f=${CMAKE_CURRENT_SOURCE_DIR}/${ARGUMENTS_CONANFILE})

to:

set(CONANFILE ${CMAKE_CURRENT_SOURCE_DIR}/${ARGUMENTS_CONANFILE})

I don't know what the significance of -f= is, but restoring it makes everything work as before.

Thanks for all your work!

Zoodinger

Argument CONANFILE assumes relative path to `CMAKE_CURRENT_SOURCE_DIR`

Passing in an absolute path will fail:

    if(ARGUMENTS_CONANFILE)
      set(CONANFILE ${CMAKE_CURRENT_SOURCE_DIR}/${ARGUMENTS_CONANFILE})
      # A conan file has been specified - apply specified options as well if provided
      foreach(ARG ${ARGUMENTS_OPTIONS})
          set(CONAN_OPTIONS ${CONAN_OPTIONS} -o ${ARG})
      endforeach()
    else()
      set(CONANFILE ".")
    endif()

How to use install packages build for gcc major versions?

conan-package-tools recently introduced gcc major versions (for gcc version >= 5). How to use these? cmake-conan detects e.g. compiler.version=5.4 but I want to use a package which was build with the conangcc5-docker image. Has cmake-conan to be adapted?

conan_cmake_install() reruns conan install even when conanfile.txt isn't updated

I wanted to use this to rerun conan install every time my conanfile.txt was updated. However, using conan_cmake_install() reruns conan install every time cmake is run. This needlessly takes a notable amount of time, and it is pretty noisy. Can we change conan_cmake_install() to only rerun conan install when necessary?


I ended up wrapping the call like so:

# Only rerun conan_cmake_install if the conanfile has changed; note that I'm using the
# cmake_paths generator. It might be worth producing our own file specific to this,
# something like:
# file(TOUCH "${CMAKE_CURRENT_BINARY_DIR}/conantimestamp.txt}")
if("${CMAKE_CURRENT_SOURCE_DIR}/conanfile.txt" IS_NEWER_THAN "${CMAKE_BINARY_DIR}/conan_paths.cmake")
  conan_cmake_install(CONANFILE "conanfile.txt")
endif()

# Rerun cmake if the conanfile has changed
set_property(DIRECTORY APPEND
  PROPERTY
    CMAKE_CONFIGURE_DEPENDS conanfile.txt
)

Ability to use libstdc++11 with clang

I'm trying to switch from gcc to clang in a project built with CMake and Conan. One of my dependencies is gtest/1.8.0@conan/stable. As mentioned by @lasote here and in this SO question, I need to add compiler.libcxx=libstdc++11 setting. Of course I can use global config or switch to proper conan usage instead of this project, but I'd like to stick to familiar cmake && cmake --build flow so that it's easier to use from IDE, especially for other devs etc.

I see there is a function called conan_cmake_detect_gnu_libcxx, which selects libstdc++11 / libstdc++ and is used for GNU compiler:

cmake-conan/conan.cmake

Lines 82 to 83 in 930a639

conan_cmake_detect_gnu_libcxx(_LIBCXX)
set(_SETTINGS ${_SETTINGS} -s compiler=gcc -s compiler.version=${MAJOR}.${MINOR} -s compiler.libcxx=${_LIBCXX})

But for Clang on non-Apple platforms -s compiler.libcxx=libstdc++ is passed:

cmake-conan/conan.cmake

Lines 102 to 104 in 930a639

else()
set(_SETTINGS ${_SETTINGS} -s compiler=clang -s compiler.version=${MAJOR}.${MINOR} -s compiler.libcxx=libstdc++)
endif()

Can we just use the same method here or more involved solution is needed? I didn't dive into the details, so I'm not sure if proposed change could break something.

conan.cmake and conan disagrees on compiler version

Ubuntu 17.10
GCC 7.2
Conan 1.0.2

Packages I build are tagged with compiler version "7.2", but conan.cmake will only accept packages with compiler version exactly "7". I believed, based on conan-io/conan#1214, that version "7.2" is-a version "7" and that the "7.2" package should be used.

More detailed information follows.

When I build packages they get marked with compiler version 7.2. For example:

➤ conan search lua/5.1.4@ibbles/stable
Existing packages for recipe lua/5.1.4@ibbles/stable:

    Package_ID: b2fcd8dec3b6100295f93388a49eba2a7d69f5a0
        [options]
            shared: True
        [settings]
            arch: x86_64
            compiler: gcc
            compiler.version: 7.2
            os: Linux
        outdated from recipe: False

In the client project we have a conanfile.txt with the following content:

➤ cat conanfile.txt 
[requires]
lua/5.1.4@ibbles/stable

[generators]
cmake

We use conan.cmake as follows

include(${CMAKE_SOURCE_DIR}/conan.cmake)

conan_cmake_run(CONANFILE conanfile.txt
    BASIC_SETUP
    CMAKE_TARGETS
    BUILD ${AGX_CONAN_BUILD_RULE}  # Set to 'all' to force rebuild of dependencies.
)

conan_flags_setup()

CMake fails with the following error message:

lua/5.1.4@algoryx/stable: WARN: Can't find a 'lua/5.1.4@ibbles/stable' package for the specified options and settings:
- Settings: arch=x86_64, compiler=gcc, compiler.version=7, os=Linux
- Options: shared=True

conan.cmake contains the following:

set(COMPILER_VERSION ${MAJOR}.${MINOR})
if(${MAJOR} GREATER 4)
    set(COMPILER_VERSION ${MAJOR})
endif()

If I comment out the if block then I get the package I expect.

Is this expected behavior? If so, what should I do to be able to use my packages in my client application?

conan.cmake does not respect settings from profile

I can see that in the master branch as of 12 hours ago, conan.cmake does not respect the compiler.libcxx setting from the profile if using GCC as your compiler (conan.cmake line 88).

Is this the intended behaviour?

I have set compiler.libcxx to libstdc++ in my profile, but conan insists on using libstdc++11 anyway when compiling. I am using MingW w64 gcc version 7.1.

Edit: Ok, not exactly sure it was the change from 12 hours ago, but I just had this problem now and I downloaded the conan.cmake file several times yesterday and did not have the problem...

Edit again: Still on conan 0.30.3

Regards
Lau Bakman

Linux i386 binaries are not available at cmake.org

Tried to install cmake_installer/3.11.3@conan/stable (arch=x86), got an error:

cmake_installer/3.11.3@conan/stable: Building your package in /home/conan/.conan/data/cmake_installer/3.11.3/conan/stable/build/445cf80f611c1d1eda08bde2ebc5066218ca9701
cmake_installer/3.11.3@conan/stable: Configuring sources in /home/conan/.conan/data/cmake_installer/3.11.3/conan/stable/source
cmake_installer/3.11.3@conan/stable: Copying sources to build folder
cmake_installer/3.11.3@conan/stable: Generator txt created conanbuildinfo.txt
cmake_installer/3.11.3@conan/stable: Calling build()
cmake_installer/3.11.3@conan/stable: Downloading: https://cmake.org/files/v3.11/cmake-3.11.3-Linux-i386.tar.gz
/usr/local/lib/python2.7/dist-packages/urllib3/connectionpool.py:857: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning)
cmake_installer/3.11.3@conan/stable: 
cmake_installer/3.11.3@conan/stable: ERROR: Package '445cf80f611c1d1eda08bde2ebc5066218ca9701' build failed
cmake_installer/3.11.3@conan/stable: WARN: Build folder /home/conan/.conan/data/cmake_installer/3.11.3/conan/stable/build/445cf80f611c1d1eda08bde2ebc5066218ca9701
Traceback (most recent call last):
  File "build.py", line 26, in <module>
    main()
  File "build.py", line 23, in main
    builder.run()
  File "/usr/local/lib/python2.7/dist-packages/cpt/packager.py", line 376, in run
    self.run_builds(base_profile_name=base_profile_name)
  File "/usr/local/lib/python2.7/dist-packages/cpt/packager.py", line 453, in run_builds
    r.run()
  File "/usr/local/lib/python2.7/dist-packages/cpt/runner.py", line 74, in run
    test_folder=self._test_folder)
  File "/usr/local/lib/python2.7/dist-packages/conans/client/conan_api.py", line 79, in wrapper
    return f(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/conans/client/conan_api.py", line 327, in create
    test_build_folder, test_folder, conanfile_path)
  File "/usr/local/lib/python2.7/dist-packages/conans/client/cmd/create.py", line 40, in create
    test_build_folder=test_build_folder)
  File "/usr/local/lib/python2.7/dist-packages/conans/client/cmd/test.py", line 39, in install_build_and_test
    keep_build=keep_build)
  File "/usr/local/lib/python2.7/dist-packages/conans/client/manager.py", line 280, in install
    installer.install(deps_graph, keep_build)
  File "/usr/local/lib/python2.7/dist-packages/conans/client/installer.py", line 259, in install
    self._build(nodes_by_level, deps_graph, keep_build, root_node)
  File "/usr/local/lib/python2.7/dist-packages/conans/client/installer.py", line 281, in _build
    self._handle_node_cache(node, package_id, keep_build, processed_package_references)
  File "/usr/local/lib/python2.7/dist-packages/conans/client/installer.py", line 298, in _handle_node_cache
    self._build_package(node, package_ref, output, keep_build)
  File "/usr/local/lib/python2.7/dist-packages/conans/client/installer.py", line 377, in _build_package
    raise exc
conans.errors.ConanExceptionInUserConanfileMethod: cmake_installer/3.11.3@conan/stable: Error in build() method, line 75
	tools.download(url, dest_file, verify=False)
	NotFoundException: Not found: https://cmake.org/files/v3.11/cmake-3.11.3-Linux-i386.tar.gz

Cleanup after conan 0.19

PR #13 had some things to work with conan 0.18.

As long as this cmake-conan repo is alpha, I suggest to keep moving forward and clean everything to match only the latest conan release.

BUILD parameter causing error

I followed the docs here http://docs.conan.io/en/latest/howtos/vs2017_cmake.html to create a simple Visual Studio sdl2 project using SDL2/2.0.7@bincrafters/stable

It compiles and runs fine in x86 Debug, but any other configuration complained that there was no prebuilt package, and suggested I needed to try "--build SDL2". I added the BUILD missing parameter to the conan_cmake_run() line, but with this the error is more mysterious:

1> PROJECT: Installing D:/Dev/vs/sdlconancmake/conanfile.txt
1> Requirements
1>     SDL2/2.0.7@bincrafters/stable from local
1>     libiconv/1.15@bincrafters/stable from conan-center
1> Packages
1>     SDL2/2.0.7@bincrafters/stable:dc9c05d50f7ee47ac10a455d7e592a61d7c75f59
1>     libiconv/1.15@bincrafters/stable:6cc50b139b9c3d27b3e9042d5f5372d327b3a9f7
1> 
1> libiconv/1.15@bincrafters/stable: Already installed!
1> ERROR: Error while trying to get recipe sources for SDL2/2.0.7@bincrafters/stable. No remote defined

The error is the same regardless if I do BUILD missing or BUILD SDL2

Complete CMakeLists.txt

project(Example CXX)
cmake_minimum_required(VERSION 3.8.0)

find_package(OpenGL)

# Download automatically, you can also just copy the conan.cmake file
if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan")
    file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/v0.9/conan.cmake"
                "${CMAKE_BINARY_DIR}/conan.cmake")
endif()

include(${CMAKE_BINARY_DIR}/conan.cmake)

conan_cmake_run(CONANFILE conanfile.txt
                BASIC_SETUP CMAKE_TARGETS
				BUILD SDL2)

set(exetype)
if(MSVC)
  set(exetype WIN32)
endif(MSVC)

add_executable(example ${exetype} example.cpp)
target_link_libraries(example ${CONAN_LIBS} ${OPENGL_gl_LIBRARY})

conanfile.txt:

[requires]
SDL2/2.0.7@bincrafters/stable

[generators]
cmake

And example.cpp, contents are irrelevant.

if BUILD_TYPE is specified, cmake generator should be used instead of cmake_multi

If the user has overridden the default BUILD_TYPE, script currently uses cmake_multi generator and two times installs the requested build_type, which then generates cmake configuration error because another build_type is missing (i.e. if the user has selected Debug build type, the user wants to use it in all configurations within its IDE and CMake throws error that cmakebuildinfo_release.cmake is missing).

Here is my dirty workaround for that issue from wrapper script that invokes your and performs additional setup specific for our internal build system.

Full rebuild after cmake

Every time I run cmake, the whole project rebuilds, even if nothing has changed. Our full build takes quite long time and want to avoid redundant building whenever possible.

I have traced this problem to a sequence of whitespace being added to the compiler command line, which cause every source file to be recompiled!

I think the root cause of this is in the conanbuildinfo.cmake, in the conan_define_targets macro. It contains

    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CONAN_CMD_CXX_FLAGS}")

And CONAN_CXX_FLAGS get an additional whitespace every time it is evaluated.

set(CONAN_CXX_FLAGS " ${CONAN_CXX_FLAGS}")

Same thing with CMAKE_C_FLAGS, CMAKE_SHARED_LINKER_FLAGS

AppleClang identification dependes on CMP0025

Identification of AppleClang compiler in CMAKE_CXX_COMPILER_ID depends on CMP0025 being set to NEW.

However the default behavior is OLD

Unlike most policies, CMake version 3.0.2 does not warn by default when this policy is not set and simply uses OLD behavior. See documentation of the CMAKE_POLICY_WARNING_CMP0025 variable to control the warning.

To help detect this issue cmake-conan should enable the CMAKE_POLICY_WARNING_CMP0025 flag and/or check the value of CMP0025 policy on Mac builds. Also note that this policy must be set before the project declaration.

Otherwise we just get this error

ERROR: Invalid setting '7.0' is not a valid 'settings.compiler.version' value.
Possible values are ['3.3', '3.4', '3.5', '3.6', '3.7', '3.8', '3.9']

because it is identified as Clang instead of AppleClang

Under Visual Studio 15.3.4 lack of $PLATFORM environment variable causes generation to fail

This seem to happen only under VS IDE. Standalone CMake 3.9.0 with same VS15 toolchain, same machine, same project - didn't have this problem. Maybe that effect of VS using Ninja internally. The workaround is to create this variable, but that causes problems on different occasions.

Severity	Code	Description	Project	File	Line	Suppression State
Error		CMake Error at C:/Users/#####/CMakeBuilds/316c7597-0638-b33f-a43a-f74b1dfab3d1/build/x86-Debug/conan.cmake:115 (if):
  if given arguments:

    "STREQUAL" "X64"

  Unknown arguments specified		C:/Users/#####/CMakeBuilds/316c7597-0638-b33f-a43a-f74b1dfab3d1/build/x86-Debug/conan.cmake	115	

Using conan_cmake_run() to obtain an executable target ?

My CMake script contains the following command to obtain a command-line tool:

conan_cmake_run(REQUIRES gpcbin2c/0.1.1@jpgygax68/testing
                BASIC_SETUP CMAKE_TARGETS
                BUILD missing)
if (NOT TARGET CONAN_PKG::gpcbin2c)
  message(FATAL_ERROR "no target CONAN_PKG::gpcbin2c")
endif()

The check succeeds, but when I try to use the tool like this:

        add_custom_command(
            OUTPUT ${header_file} ${source_file}
            DEPENDS ${raster_file}
            # TODO: use "bin2c" instead of "gpcbin2c"
            COMMAND CONAN_PKG::gpcbin2c ARGS
                -i ${raster_file}
                -c ${font_id}_${size}
                -h ${header_file}
                -s ${source_file}
        )

the build system (msbuild) reports an error about an invalid path - evidently it tries to interpret CONAN_PKG::gpcbin2c as a path.
I'm not entirely sure this is a Conan problem, but it made me realize that conan_cmake_run() appears to create a target that is assumed to be a library. Is there any way to obtain an executable target instead ?

build_requirements possible

Hey,

i have a little question. Is it possible to set build_requirements with the conan-cmake commands?

I have a complex app where i want to use conan-cmake, but know i see some "troubles" with the feature set. Using an existing conanfile.py would be possible, but then i have to provide a template python file, because i want to turn on/off features in my build (mostly via cmake).

Any ideas, suggestions, experience?

Greetings
Tonka

Re-run cmake configure step when conanfile is updated

Hi!
It would be convenient if CMake kept track of the conanfile, and re-ran the cmake scripts when building if conanfile has been changed. One "workaround" at the moment is to touch CMakeLists.txt if a requirement is updated in the conanfile, and then build.

Any plans of adding support for emscripten?

I am getting while using version 0.8.

CMake Error at build/Debug/conan.cmake:61 (message):
  cmake system Emscripten is not supported by conan.  Use one of
  Windows;Linux;Macos;Android;iOS;FreeBSD

Here is how my CMakeList.txt looks like:

cmake_minimum_required(VERSION 3.9.3)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_FLAGS "-s WASM=1 --bind")

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
if (NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
    message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan")
    file(DOWNLOAD
        "https://raw.githubusercontent.com/conan-io/cmake-conan/v0.8/conan.cmake"
        "${CMAKE_BINARY_DIR}/conan.cmake"
        EXPECTED_MD5 58bc519cadc890b5c33235defadc1176)
endif ()
include(${CMAKE_BINARY_DIR}/conan.cmake)

project(aide VERSION 0.0.1)
conan_cmake_run(
    CONANFILE conanfile.txt
    BASIC_SETUP CMAKE_TARGETS
    BUILD missing
)

set(CMAKE_EXECUTABLE_SUFFIX ".html")
file(GLOB_RECURSE SOURCE_FILES src/*.cpp)

add_executable(index ${SOURCE_FILES})

When I call cmake I am actually passing the emscripten toolchain.cmake link:

cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=/path/to/emsdk/emscripten/1.37.28/cmake/Modules/Platform/Emscripten.cmake -G "Unix Makefiles" /path/to/project/aide

Using conan.cmake in packages/libraries

Hi,

I'm developing a library that I want to turn into a conan package. It has some dependencies so I want to import them into CMake via conan.cmake while working on the library. However with this setup conan_cmake_run will do another call to conan install when installing the exported package.

I propose that conan_cmake_run will merely include conanbuildinfo.cmake and call conan_basic_setup after the package has been exported. Does conan set some flag when building a package that is easy to check, like CONAN_INSTALLING or CONAN_EXPORTED?

One limitation when using conan.cmake in a package/library is that a conanfile.py is needed so it's not possible to use the REQUIRES arguments to conan_cmake_run.

Implement user input for libstdc++ instead of libstdc++11 for gcc 5.1+

Right now, it is detected automatically based on compiler version, but older linux distros might upgrade the compiler to 5.1+ without upgrading libstdc++11, leaving old libstdc++

The user should have a way to specify that they are using the old libstdc++

The current flag detection: https://github.com/conan-io/cmake-conan/blob/master/conan.cmake#L95
seems not to be enough, at least doesn't work if defining the flag in the command line.

Support profiles

Profiles, with things as build_requires are becoming quite powerful, but they are not handled by cmake-conan. Consider some way to add them.

Possibly:

CONAN_PROFILE=gcc cmake -G "Unix Makefiles"

BUILD missing doesn't appear to work

Using

include(${CMAKE_BINARY_DIR}/conan.cmake)
conan_cmake_run(CONANFILE conanfile.py  # or relative build/conanfile.txt
        BASIC_SETUP CMAKE_TARGETS
        BUILD missing)

According to https://github.com/conan-io/cmake-conan/blob/develop/conan.cmake#L270 implies that the --build=missing flag should get invoked, but it does not.

acgetchell/CDT-plusplus@93bd9ba

┌─[adam][hapkido][±][feature/conan {1} S:2 ✗][~/CDT-plusplus]
└─▪ ./build.sh 
boost/1.68.0@conan/stable: Not found in local cache, looking in remotes...
boost/1.68.0@conan/stable: Trying with 'conan-center'...
Downloading conanmanifest.txt
[==================================================] 125B/125B        
Downloading conanfile.py
[==================================================] 21.0KB/21.0KB    
Downloading conan_export.tgz
[==================================================] 612B/612B        
PROJECT: Installing /Users/adam/CDT-plusplus/conanfile.py
Requirements
    TBB/2018_U5@conan/stable from 'conan-center' - Cache
    boost/1.68.0@conan/stable from 'conan-center' - Downloaded
    bzip2/1.0.6@conan/stable from 'conan-center' - Cache
    catch2/2.3.0@bincrafters/stable from 'conan-center' - Cache
    docopt/0.6.2@conan/stable from 'conan-center' - Cache
    eigen/3.3.5@conan/stable from 'conan-center' - Cache
    libcurl/7.60.0@bincrafters/stable from 'conan-center' - Cache
    zlib/1.2.11@conan/stable from 'conan-center' - Cache
Packages
    TBB/2018_U5@conan/stable:17bbaf14f04b80904f04c74eda265378d62c479f - Cache
    boost/1.68.0@conan/stable:337dfe4a3a2f6851af7fcc931afed4f61b4db473 - Missing
    bzip2/1.0.6@conan/stable:af96383df8ed9748d2eed48fb04099c5914a718f - Cache
    catch2/2.3.0@bincrafters/stable:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 - Cache
    docopt/0.6.2@conan/stable:de56269f90f07cc61427d9012acf098d4354f43d - Cache
    eigen/3.3.5@conan/stable:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 - Cache
    libcurl/7.60.0@bincrafters/stable:c524ca20330d4dcedff6342b243b52f8309c04c9 - Cache
    zlib/1.2.11@conan/stable:0eaf3bfbc94fb6d2c8f230d052d75c6c1a57a4ce - Cache
Build requirements
    cmake_installer/3.11.3@conan/stable from 'conan-center' - Cache
Build requirements packages
    cmake_installer/3.11.3@conan/stable:743cf0321be3152777da4d05247a66d1552e70a2 - Cache

TBB/2018_U5@conan/stable: Already installed!
bzip2/1.0.6@conan/stable: Already installed!
catch2/2.3.0@bincrafters/stable: Already installed!
cmake_installer/3.11.3@conan/stable: Already installed!
docopt/0.6.2@conan/stable: Already installed!
eigen/3.3.5@conan/stable: Already installed!
zlib/1.2.11@conan/stable: Already installed!
boost/1.68.0@conan/stable: WARN: Can't find a 'boost/1.68.0@conan/stable' package for the specified options and settings:
- Settings: arch=x86_64, build_type=Release, compiler=apple-clang, compiler.libcxx=libc++, compiler.version=9.1, os=Macos
- Options: fPIC=True, header_only=False, magic_autolink=False, shared=False, skip_lib_rename=False, without_atomic=False, without_chrono=False, without_container=False, without_context=False, without_contract=False, without_coroutine=False, without_date_time=False, without_exception=False, without_fiber=False, without_filesystem=False, without_graph=False, without_graph_parallel=False, without_iostreams=False, without_locale=False, without_log=False, without_math=False, without_mpi=False, without_program_options=False, without_python=True, without_random=False, without_regex=False, without_serialization=False, without_signals=False, without_stacktrace=False, without_system=False, without_test=False, without_thread=False, without_timer=False, without_type_erasure=False, without_wave=False, bzip2:fPIC=True, bzip2:shared=False, zlib:shared=False
- Package ID: 337dfe4a3a2f6851af7fcc931afed4f61b4db473

ERROR: Missing prebuilt package for 'boost/1.68.0@conan/stable'
Try to build it from sources with "--build boost"
Or read "http://docs.conan.io/en/latest/faq/troubleshooting.html#error-missing-prebuilt-package"

ERROR: conanbuildinfo.txt file not found in /Users/adam/CDT-plusplus/build
It is required for this command
You can generate it using 'conan install'

Option to pass -u parameter to install

I'd like to pass a --update parameter to conan install.
Should be either CONAN_UPDATE option or generic CONAN_INSTALL_OPTIONS argument to conan_cmake_run

Unable to build packages using Clang with libc++ on Linux.

In the conan.cmake file in the conan_cmake_settings function, when it checks the compiler ID, if the compiler is Clang (checked at line 145) and if the environment is not APPLE the fucntion conan_cmake_detect_gnu_libcxx is called. Inside this function it only ever sets the STL library to either libstdc++11 or libstdc++. Because of this the conan packages cannot be built with Clang using the libc++ STL implementation on Linux.

Conan.cmake fails in conan_load_buildinfo if INSTALL_FOLDER is passed as an argument

conan_load_buildinfo assumes that the conan file is located in the binary dir:
if(EXISTS "${CMAKE_CURRENT_BINARY_DIR}/${_CONANBUILDINFO}")
However when passing install_folder this is no longer the case.

I updated the following in my script:

@@ -381,7 +381,7 @@
 endfunction()
 
 
-macro(conan_load_buildinfo)
+macro(conan_load_buildinfo installFolder)
     if(CONAN_CMAKE_MULTI)
       set(_CONANBUILDINFO conanbuildinfo_multi.cmake)
     else()
@@ -389,9 +389,9 @@
     endif()
     # Checks for the existence of conanbuildinfo.cmake, and loads it
     # important that it is macro, so variables defined at parent scope
-    if(EXISTS "${CMAKE_CURRENT_BINARY_DIR}/${_CONANBUILDINFO}")
-      message(STATUS "Conan: Loading ${_CONANBUILDINFO}")
-      include(${CMAKE_CURRENT_BINARY_DIR}/${_CONANBUILDINFO})
+    if(EXISTS "${installFolder}/${_CONANBUILDINFO}")
+      message(STATUS "Conan: Loading ${installFolder}/${_CONANBUILDINFO}")
+      include(${installFolder}/${_CONANBUILDINFO})
     else()
       message(FATAL_ERROR "${_CONANBUILDINFO} doesn't exist in ${CMAKE_CURRENT_BINARY_DIR}")
     endif()
@@ -422,7 +421,11 @@
         endif()
     endif()
 
-    conan_load_buildinfo()
+    set(CONAN_INSTALL_FOLDER ".")
+    if(ARGUMENTS_INSTALL_FOLDER)
+      set(CONAN_INSTALL_FOLDER ${ARGUMENTS_INSTALL_FOLDER})
+    endif()
+    conan_load_buildinfo(${CONAN_INSTALL_FOLDER})
 
     if(ARGUMENTS_BASIC_SETUP)
         foreach(_option CMAKE_TARGETS KEEP_RPATHS NO_OUTPUT_DIRS)

Definitions and strings with spaces

Hi,

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

is there any way how I can use strings with spaces in definitions f.e.:

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

Because if I use this kind of assignment this will be created:

-DMY_DEF="My string"

When I want to use this package in an CMake project an CMake error occurs:

"Argument not separated from preceding token by whitespace."

When I edit the "conanbuildinfo.cmake" file from:

set(CONAN_DEFINES -DMY_DEF="My string")

to:

set(CONAN_DEFINES "-DMY_DEF=\"My string\"")

everything works fine.

I'm would very appreciating any help in that matter!

My system info:
conan version: 1.2.0
CMake version: 3.11.0
Os version: Win 10 x64
Python version: 2.7.14

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.