iauns / cpm Goto Github PK
View Code? Open in Web Editor NEWC++ Package Manager
Home Page: http://cpm.rocks
License: MIT License
C++ Package Manager
Home Page: http://cpm.rocks
License: MIT License
CMakeLists.txt
...
include(cmake/FindCPM.cmake)
CPM_AddModule("cpm-catch"
GIT_REPOSITORY "https://github.com/designerror/cpm-catch")
...
CPM_EnsureRepoIsCurrent(
TARGET_DIR ${CATCH_DIR}
GIT_REPOSITORY "https://github.com/philsquared/Catch.git"
GIT_TAG origin/master
USE_CACHING TRUE
)
CMake-GUI Log
Git error for directory 'C:/Users/designerror/Documents/workspace/projects/webdav-client/build/x64/cpm-packages/modules/github_designerror_cpmcatch_origin_master/src/catch'
CMake Error at build/x64/cpm-packages/util/CPMGit.cmake:131 (message):
Failed to checkout tag: 'origin/master'
Call Stack (most recent call first):
build/x64/cpm-packages/util/CPMCommonSCM.cmake:6 (_cpm_update_git_repo)
build/x64/cpm-packages/util/CPMCommonSCM.cmake:115 (_cpm_scm_update)
build/x64/cpm-packages/util/CPMGit.cmake:159 (_cpm_ensure_scm_repo_is_current)
build/x64/cpm-packages/CPM.cmake:906 (_cpm_ensure_git_repo_is_current)
build/x64/cpm-packages/modules/github_designerror_cpmcatch_origin_master/src/CMakeLists.txt:41 (CPM_EnsureRepoIsCurrent)
Configuring incomplete, errors occurred!
I have adapted a C++ library I have made, for CPM. The library/module builds without issues when added to a (top-level) parent; however, attempting to build the module by itself yields in error messages, e.g. the following when building using Visual Studio 2013:
[snip]\cpm-packages\tests\ghost-git-repo\main.cpp(2): fatal error C1083: Cannot open include file: 'cpm-test-01/module.hpp': No such file or directory [[snip].vcxproj]
For some reason, CPM's tests are added to my VS project so that it attempts bulding the tests before my own code.
My CMakeLists.txt file currently looks mostly like this:
cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
#-----------------------------------------------------------------------
# CPM configuration
#-----------------------------------------------------------------------
set(CPM_MODULE_NAME "my_library")
set(CPM_LIB_TARGET_NAME ${CPM_MODULE_NAME})
if ((DEFINED CPM_DIR) AND (DEFINED CPM_UNIQUE_ID) AND (DEFINED CPM_TARGET_NAME))
set(CPM_LIB_TARGET_NAME ${CPM_TARGET_NAME})
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CPM_DIR})
include(CPM)
else()
set(CPM_DIR "${CMAKE_CURRENT_BINARY_DIR}/cpm-packages" CACHE TYPE STRING)
find_package(Git)
if(NOT GIT_FOUND)
message(FATAL_ERROR "CPM requires Git.")
endif()
if (NOT EXISTS ${CPM_DIR}/CPM.cmake)
message(STATUS "Cloning repo (https://github.com/iauns/cpm)")
execute_process(
COMMAND "${GIT_EXECUTABLE}" clone https://github.com/iauns/cpm ${CPM_DIR}
RESULT_VARIABLE error_code
OUTPUT_QUIET ERROR_QUIET)
if(error_code)
message(FATAL_ERROR "CPM failed to get the hash for HEAD")
endif()
endif()
include(${CPM_DIR}/CPM.cmake)
endif()
# Include CPM modules or externals here (with CPM_AddModule).
CPM_AddModule("dep_name"
GIT_REPOSITORY "repo_url"
GIT_TAG "tag_name")
CPM_InitModule(${CPM_MODULE_NAME})
CPM_ExportAdditionalLibraryTarget(${CPM_LIB_TARGET_NAME})
#-----------------------------------------------------------------------
# Source
#-----------------------------------------------------------------------
file(GLOB_RECURSE Sources src
"*.cpp"
)
#-----------------------------------------------------------------------
# Library setup
#-----------------------------------------------------------------------
add_library(${CPM_LIB_TARGET_NAME} SHARED ${Sources})
target_link_libraries(${CPM_LIB_TARGET_NAME} ${CPM_LIBRARIES})
Thank you for any assistance you can provide.
I have the package "cpm-google-test" installed, and it breaks my build with -Werror because it looks like a macro with hyphens in it is being generated:
<command line>:2:16: error: ISO C99 requires whitespace after the macro name [-Werror,-Wc99-extensions]
#define CPM_CPM-GOOGLE-TEST_NS github_iauns_cpmgoogletest_102
I didn't follow the trail to find out who was defining it, so I could very well be wrong who's at fault. If possible, could we change those hyphens to underscores so that C99 is happy?
Hi,
The CPM_AddModule command is throwing me the following error:
CMake Error at cpm-packages/CPM.cmake:1246 (message):
A module (opencv2) failed to define its name!
Call Stack (most recent call first):
CMakeLists.txt:27 (CPM_AddModule)
This is the definition in my CMakeLists.txt:
CPM_AddModule("opencv2"
GIT_REPOSITORY "https://github.com/Itseez/opencv"
GIT_TAG "3.0.0"
USE_EXISTING_VER TRUE)
Is this because opencv2 is not a registered CPM module?
If so, I did submit the repository at cpm rocks, do I need to prepare the repository with a configuration for CPM or is that enough?
If not, please tell me what could be the problem
Thanks
Provided sample from README fails to build.
Using MSVC2013 and CMake 2.8.12.1
D:\Archivos de programa (x86)\Microsoft Visual Studio 12.0\VC\k>cmake . -G "NMake Makefiles"
-- The C compiler identification is MSVC 18.0.21005.1
-- The CXX compiler identification is MSVC 18.0.21005.1
-- Check for working C compiler: D:/Archivos de programa (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe
-- Check for working C compiler: D:/Archivos de programa (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: D:/Archivos de programa (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe
-- Check for working CXX compiler: D:/Archivos de programa (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found Git: C:/Program Files (x86)/Git/cmd/git.exe (found version "1.8.4.msysgit.0")
-- Cloning repo (https://github.com/iauns/cpm)
-- Cloning repo (https://github.com/iauns/cpm-gl-platform @ 1.1.1)
-- Cloning repo (https://github.com/SCIInstitute/spire @ 0.7.1)
-- Cloning repo (https://github.com/iauns/cpm-glm @ origin/master)
-- Cloning repo (https://github.com/g-truc/glm.git @ 0.9.4.6)
-- Found OpenGL: opengl32
-- Cloning repo (https://github.com/iauns/cpm-mongoc-legacy @ 1.0.0)
CMake Error at cpm_packages/modules/github_iauns_cpmmongoclegacy_100/src/CMakeLists.txt:47 (ExternalProject_Add):
Unknown CMake command "ExternalProject_Add".
-- Configuring incomplete, errors occurred!
See also "D:/Archivos de programa (x86)/Microsoft Visual Studio 12.0/VC/k/CMakeFiles/CMakeOutput.log".
What is the proper way to gather source files and generated artifacts (*.dll, *.lib, etc) from CPM modules my top-level CMake project depends on?
Due to the way CPM organizes source repositories and artifacts, it seems to be a bit difficult to reliably do things like copy *.dll files to where my main executable resides (for easier debugging, packaging, etc).
Some examples:
I have seen some solutions for CMake which involves...
My next idea was to set a cached variable in each child, e.g. something like this:
set(${CPM_MODULE_NAME}_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" CACHE INTERNAL "")
My issues with this approach are:
Thank you for any assistance you can provide!
Hi, thank you for the awesome project!
I found CPM don't sanitize '@' in ssh style git repo address.
For example, when I set [email protected]:iauns/cpm.git
to GIT_REPOSITORY
, I'm getting following error:
CMake Error at cpm_packages/CPM.cmake:986 (set):
Syntax error in cmake code at
{WHERE MY PROJECT IS}/cpm_packages/CPM.cmake:986
when parsing string
${_CPM_SAVE_REC_MOD_VAR_git@githubcomiauns_cpm_origin_master}
syntax error, unexpected @, expecting } (62)
Call Stack (most recent call first):
cpm_packages/CPM.cmake:994 (_cpm_handle_exports_for_module_rec)
cpm_packages/CPM.cmake:1247 (_cpm_handle_exports_for_module)
CMakeLists.txt:15 (CPM_AddModule)
-- Configuring incomplete, errors occurred!
cmake
version is 3.0.1
I guess this will be resolved by adding '@'
to https://github.com/iauns/cpm/blob/master/CPM.cmake#L830
It would be nice if this will be improved!
Thank you!
for example I want to cpm-ify ofxiosboost, which brings a pre-built library. I can not add_library, since it already exists...
Hi,
I would really like to use cpm in my project, but I can't figure out how to most simply add an external project. For example in my app I need an (iOS tuned version of) freetype:
https://github.com/cdave1/freetype2-ios.git
I was hoping I can just get this directly, but I feel I have to clone it and make it cpm ready? what about these json files you demonstrate for google test, can I just write one of those instead and place it in my own project?
I would like to talk with you about this project. u fortunately I couldn't find any email address of you. could you please contact me by this address:
[email protected]
I'm new to this library so some documentation around common errors like:
"message(FATAL_ERROR "A module (${name}) failed to define its name!")" from CPM.cmake L1246
would be great... e.g
"CPM_AddModule(
"glaze"
GIT_REPOSITORY "https://github.com/stephenberry/glaze"
GIT_TAG "v2.5.2"
)" and the actual glm repo both seem to have this error...
It is very difficult to search for registered packages, basically amounts to using Google.
For example:
we have A project and B project and they all use glm. We may pre-download it to a directory like "~/cpm_modules/" and you may let us specify it.
After a search for the directory and got a not-found, and then fall back to download it to the build directory.
Hello,
There is at least one interesting project I'd like to create a CPM module for. Unfortunately the project uses Hg.
https://bitbucket.org/tunnuz/json/overview
I would love to see CPM become the tool of choice for c++ libraries to make themselves available to a wider audience. This might be one step to making that happen. Projects in general are starting to use CMake more frequently which is a good path as well.
Anyway, before I just create a git mirror of that repo I thought I'd get a feel for the work involved in supporting mercurial in CPM instead.
Cheers,
Chip
when i define the caching dir I get errors like:
-- Cloning git repo (https://github.com/iauns/cpm-glm @ origin/master)
CMake Error at build/libs/DOpenGL/cpm_packages/util/CPMGit.cmake:44 (message):
Failed to checkout tag: 'origin/master'
Call Stack (most recent call first):
build/libs/DOpenGL/cpm_packages/util/CPMCommonSCM.cmake:18 (_cpm_clone_git_repo)
build/libs/DOpenGL/cpm_packages/util/CPMCommonSCM.cmake:92 (_cpm_scm_clone)
build/libs/DOpenGL/cpm_packages/util/CPMGit.cmake:159 (_cpm_ensure_scm_repo_is_current)
build/libs/DOpenGL/cpm_packages/CPM.cmake:906 (_cpm_ensure_git_repo_is_current)
build/libs/DOpenGL/cpm_packages/CPM.cmake:1107 (CPM_EnsureRepoIsCurrent)
libs/DOpenGL/CMakeLists.txt:23 (CPM_AddModule)
Hi James
I've been developing a package manager with cmake after being inspired by and contributing to your project. However it has reached a level that is hard to mantain alone. Also i havent yet implemented support for multiple statically linked versions of a library. I would love to hear if you would be interested in discussing my project: at https://github.com/toeb/cutil.
Greetings from Germany,
Tobi
I tried for a couple of hours and did not find a solution.
For example, this package: yaml-cpp is on the website: http://www.cpm.rocks/mod/gh/jbeder/yaml-cpp
In my CMakelist.txt:
CPM_AddModule("yaml-cpp"
GIT_REPOSITORY "https://github.com/jbeder/yaml-cpp"
GIT_TAG "origin/master"
USE_EXISTING_VER TRUE
)
Running cmake will alert me:
A module (yaml-cpp) failed to define its name!
Same goes with many other packages on the website. I found that it seems only that is a wrapper instead of the actual code repo would work. For example, the "cpm-boost" works.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.