Skip to content
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

cmake error with relic #209

Open
mialuyao opened this issue Dec 24, 2023 · 1 comment
Open

cmake error with relic #209

mialuyao opened this issue Dec 24, 2023 · 1 comment

Comments

@mialuyao
Copy link

I have installed ABY, ENCRYPTO_utils and relic successfully, and passed all tests.
But when I compile my project, I get the problem as
CMake Error at /usr/local/lib/cmake/ENCRYPTO_utils/ENCRYPTO_utilsTargets.cmake:61 (set_target_properties):
The link interface of target "ENCRYPTO_utils::encrypto_utils" contains:

RELIC::relic

but the target was not found. Possible reasons include:

* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.

Call Stack (most recent call first):
/usr/local/lib/cmake/ENCRYPTO_utils/ENCRYPTO_utilsConfig.cmake:12 (include)
/usr/local/share/cmake-3.26/Modules/CMakeFindDependencyMacro.cmake:76 (find_package)
/usr/local/lib/cmake/OTExtension/OTExtensionConfig.cmake:7 (find_dependency)
/usr/local/share/cmake-3.26/Modules/CMakeFindDependencyMacro.cmake:76 (find_package)
/usr/local/lib/cmake/ABY/ABYConfig.cmake:7 (find_dependency)
CMakeLists.txt:7 (find_package)
What's wrong with it?
Thank you.

@RanNiGuai
Copy link

#looks dirty, but since the relic library is poorly exported let's treat it as an external library
if(CMAKE_LIBRARY_OUTPUT_DIRECTORY)
set(RELIC_LIB_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/librelic_s.a")
else()
set(RELIC_LIB_DIR "${CMAKE_CURRENT_BINARY_DIR}/extern/relic/lib/librelic_s.a")
endif()

add_library(RELIC::relic STATIC IMPORTED)
set_target_properties(RELIC::relic PROPERTIES
IMPORTED_LOCATION ${RELIC_LIB_DIR}
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/extern/relic/include;${CMAKE_CURRENT_SOURCE_DIR}/extern/relic/include/low;${CMAKE_CURRENT_BINARY_DIR}/extern/relic/include"
)

target_link_libraries(RELIC::relic INTERFACE relic_s)

CMakeLista.txt in ENCRYTPO_utils deal like this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants