find_package and CPMFindPackage have different behaviors · Issue #132 · cpm-cmake/CPM.cmake (original) (raw)
Hello,
I'm using CPMFindPackage() to check for a dependency on CMocka and noticing some strange behavior with the find_package
portion. Do you know what I might be doing wrong here?
CPMFindPackage(
NAME CMOCKA
GIT_REPOSITORY https://git.cryptomilk.org/projects/cmocka.git/
VERSION 1.1.5
GIT_TAG cmocka-1.1.5
OPTIONS
"WITH_EXAMPLES OFF"
)
message("CMOCKA_FOUND: ${CMOCKA_FOUND}")
message("CMOCKA_ADDED: ${CMOCKA_ADDED}")
message("CMOCKA_INCLUDES: ${CMOCKA_INCLUDE_DIR}")
message("CMOCKA_LIBRARIES: ${CMOCKA_LIBRARIES}")
The library is installed on my system with a CMake config file. I see this output from CPM, but the FOUND/ADDED variables are not set, and the other variables defined by the config file aren't used.
-- CPM: using local package CMOCKA@1.1.5
CMOCKA_FOUND:
CMOCKA_ADDED:
CMOCKA_INCLUDES:
CMOCKA_LIBRARIES:
If I remove CPMFindPackage
and add find_package
:
This time, CMOCKA_FOUND
will be defined, and the values defined by the config file are used.
CMOCKA_FOUND: 1
CMOCKA_ADDED:
CMOCKA_INCLUDES: /usr/local/include
CMOCKA_LIBRARIES: /usr/local/lib/libcmocka.dylib