-
Notifications
You must be signed in to change notification settings - Fork 57
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 Cannot specify link libraries for target "xtensor-blas" which is not built #169
Comments
Can you include more details:
|
Hello, sorry for the lack of details. Cmake version : 3.10 (from ubuntu 18.04 package manager). cmake_minimum_required(VERSION 3.10)
project(cmake_test VERSION 0.1)
find_package(Eigen3 REQUIRED)
find_package(xtensor REQUIRED)
find_package(xtensor-blas REQUIRED) cmake command : For xtensor-blas installation :
content of CMAKE_PREFIX_PATH : /home/narvorpi/work/narval/soft/install
if(NOT TARGET xtensor-blas)
include("${CMAKE_CURRENT_LIST_DIR}/xtensor-blasTargets.cmake")
if(NOT TARGET xtensor-blas)
message(STATUS "No xtensor-blas target")
else()
message(STATUS "xtensor-blas target exists") # this is displayed on configure
endif()
get_target_property(xtensor-blas_INCLUDE_DIRS xtensor-blas INTERFACE_INCLUDE_DIRECTORIES)
find_dependency(BLAS REQUIRED)
find_dependency(LAPACK REQUIRED)
target_link_libraries(xtensor-blas INTERFACE ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES}) #this is le line which fails
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.8)
target_compile_features(xtensor-blas INTERFACE cxx_std_14)
endif()
endif() |
I finally managed to make it work, but I had to edit the xtensor-blasConfig.cmake. However I am by no means a cmake wizard, so I really don't understand why this works but not the original code.
by these ones:
If you can throw some light on this, I would really appreciate it. |
I think it has to do with your CMake version not accepting a more modern CMake version. You did exactly the same as what there was before with simple a different 'syntax'. To increase robustness we could update the CMake config with your code, possibly with a switch based on the CMake version. |
At the same time, it might be worth updating your CMake. |
Ok. Thanks for your reply. I will look into it. However, shouldn't the |
Indeed we should keep the minimum required version consistent with the implementation. I think this requirement was left because of old versions of Ubuntu which should not be so much used now. |
Ok. Thank you for your help ! |
@JohanMabille Do you know which CMake version supports what in terms of the target? I have seen this this problem before in several libraries, but I cannot find the right details in the CMake documentation. |
Not really, I need to do some cmake archeology. We also need to check which version of cmake is installed on "recent" release of Ubuntu (or check if updating CMake on Ubuntu is still a nightmare). |
I'm still so surprised that such old CMake's are shipped... But ok, we should deal with it. |
fyi, I installed cmake from sources and it worked right away. (I installed on user side though. I did not try to update the system-installed cmake). Also, it solved the issue above. |
Both target_link_libraries() and target_compile_features() are supposed to be in the lists file (not the config file). I created a PR (#193) to resolve this. |
I tried to compile a small test with xtensor-blas but I can't get cmake to configure properly. I installed xtensor-blas using cmake in a user directory pointed by CMAKE_PREFIX_PATH. The xtensor-blasConfig.cmake is found but i get the following error :
Seems like the target is created in xtensor-blasTargets.cmake, the xtensor-blasConfig.cmake sees the target but for a reason this line fails.
target_link_libraries(xtensor-blas INTERFACE ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES})
Any ideas ?
The text was updated successfully, but these errors were encountered: