-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CPM name of the package MUST NOT be exported target name #560
Comments
The CPMFindPackage(
NAME libzmq
...
FIND_PACKAGE_ARGUMENTS "NAMES ZeroMQ"
) I'm not sure if this is properly explained in the docs. I'm not quite following your first point. This behavior seems typical for most larger dependencies, like Boost. Even for smaller dependencies the name used to declare a dependency often doesn't match the exported target names, regardless of the dependency provider/package manager that is being used. However, I can see situations where the statement "should be the exported target's name" might mislead someone into thinking they actually have to match. It doesn't really matter what you set as |
Thank you. This is very useful, but not obvious. I probably missed this when I read the documentation.
Yes. You are right. The problem was with ZeroMQ under Windows+MSVS. Under Linux all works. if (NOT ZeroMQ_FOUND)
add_third_party(NAME "libzmq"
GITHUB_REPOSITORY "zeromq/libzmq"
VERSION "4.3.5"
OPTIONS
"WITH_DOCS OFF"
"BUILD_TESTS OFF"
"ENABLE_CPACK OFF")
endif() Main part of the add_third_party() code: if(NOT "${module_name}" STREQUAL NAME)
cpm_parse_add_package_single_arg("${module_name};${ARGN}" ARGN)
# The shorthand syntax implies EXCLUDE_FROM_ALL and SYSTEM
list(GET ARGN 1 _repo_name)
get_filename_component(_repo_name ${_repo_name} NAME)
CPMADDPackage(${ARGN}
EXCLUDE_FROM_ALL YES
SYSTEM YES
SOURCE_DIR "${KNP_ROOT_DIR}/third-party/${_repo_name}")
else()
list(GET ARGN 0 _m_name)
CPMADDPackage("${module_name}" ${ARGN}
EXCLUDE_FROM_ALL YES
SYSTEM YES
SOURCE_DIR "${KNP_ROOT_DIR}/third-party/${_m_name}")
endif()
Yes, it will be more obvious. |
NAME # The unique name of the dependency (should be the exported target's name)
There are two problems:
lib
andlib_static
).find_package()
will not work for some packages. I.e. for ZeroMQ. If I name the dependency ZeroMQ I will get an error in the Windows build, if I name dependencylibzmq
, it will be always downloaded, becausefind_package()
doesn't found it.The text was updated successfully, but these errors were encountered: