likle / cwalk

Path library for C/C++. Cross-Platform for Linux, FreeBSD, Windows and MacOS. Supports UNIX and Windows path styles on those platforms.
https://likle.github.io/cwalk/
MIT License
253 stars 40 forks source link

Conan package #7

Closed mjako78 closed 4 years ago

mjako78 commented 4 years ago

Hi, I'm trying to use your lib inside my project which is based on conan package manager.

Are you planning to release your work to the conan package center?

I have some difficulties to use embed cwalk downloaded directly via CMakeLists ExternalProject

likle commented 4 years ago

Hi @mjako78, sounds interesting - I will have a look at that!

mjako78 commented 4 years ago

Let me known if I can help.

likle commented 4 years ago

Hi @mjako78,

I have requested access to be able to add a package and was told it would take 1-2 weeks. Since you were trying to use CMake's ExternalProject, FetchContent might be a workaround for you in the meantime.

Here's an example for CMake 3.16+:

cmake_minimum_required(VERSION 3.16)
project(myproject)
include(FetchContent)
FetchContent_Declare(cwalk
  GIT_REPOSITORY git@github.com:likle/cwalk.git
  GIT_TAG v1.2.2
)
FetchContent_MakeAvailable(cwalk)
add_executable(myproject myproject.c)
target_link_libraries(myproject cwalk)

or if you want to support CMake 3.11+:

cmake_minimum_required(VERSION 3.11)
project(myproject)
include(FetchContent)
FetchContent_Declare(cwalk
  GIT_REPOSITORY git@github.com:likle/cwalk.git
  GIT_TAG v1.2.2
)
FetchContent_GetProperties(cwalk)
if(NOT cwalk_POPULATED)
  FetchContent_Populate(cwalk)
  add_subdirectory(${cwalk_SOURCE_DIR} ${cwalk_BINARY_DIR})
endif()
add_executable(myproject myproject.c)
target_link_libraries(myproject cwalk)

And then you should be able to include and use cwalk without any further steps.

mjako78 commented 4 years ago

Hi @likle,

thanks for your reply.
I'm trying with a CMake module taken from here, named DownloadProject.
I will try also the solution that you provided.

likle commented 4 years ago

cwalk is now in the conan center index: https://conan.io/center/cwalk/1.2.2/