idealvin / coost

A tiny boost library in C++11.
Other
3.96k stars 560 forks source link

not work with vcpkg #220

Open vjeson opened 2 years ago

vjeson commented 2 years ago

error message Could not find a package configuration file provided by "cocoyaxi" with any 1> [CMake] of the following names: 1> [CMake] 1> [CMake] cocoyaxiConfig.cmake 1> [CMake] cocoyaxi-config.cmake 1> [CMake] CmakeLists.txt ` find_package(cocoyaxi REQUIRED CONFIG)

target_link_libraries(cotest cocoyaxi::co) `

idealvin commented 2 years ago

Cmake config has not been pushed to vcpkg yet, should be supported in the next release.

vipcxj commented 8 months ago

所以还在支持了没?

sappho192 commented 1 month ago

If you are using CMake, try including the coost repository as git submodule, and include it to CMakeList.txt directly.

In my case, root CMakeLists.txt is like:

cmake_minimum_required(VERSION 3.15)
project(cpp_template)

# Find dependencies provided by vcpkg (via vcpkg.cmake)
find_package(fmt CONFIG REQUIRED)

# main target
add_subdirectory(src/coost coost)
add_subdirectory(src/hello hello)

and the subproject's CMakeList.txt is like:

project(hello)

add_executable(hello main.cpp)

message("CMAKE_BINARY_DIR=${CMAKE_BINARY_DIR}")
message("CMAKE_HOME_DIRECTORY=${CMAKE_HOME_DIRECTORY}")
message("CMAKE_CONFIGURATION_TYPES=${CMAKE_CONFIGURATION_TYPES}")

find_package(fmt CONFIG REQUIRED)
target_link_libraries(hello fmt::fmt-header-only)
include_directories(${CMAKE_HOME_DIRECTORY}/src/coost/include)
target_link_libraries(hello co) # coost is co

set_property(TARGET hello PROPERTY CXX_STANDARD 20)

Check my example repository for more details: https://github.com/sappho192/cpp_dll_test