Version number not properly read by Cmake when using Blaze_Import.cmake due to wrong path

Issue #407 resolved
Nils-Christian Kempke created an issue

Hi,

I just tried to include blaze into my project and ran into a minor issue witch blazes version detection. I included blaze via

git clone https://nckempke@bitbucket.org/blaze-lib/blaze.git

and

list(APPEND CMAKE_MODULE_PATH ${BLAZE_LIBRARY_PATH}/cmake)
include(Blaze_Import)

plus

Blaze_Import(ARGUMENTS)
target_link_libraries(TARGET Blaze)

as described in the wiki. I used the default suggested arguments slightly modified:

Blaze_Import(
        DEBUG
        BLAS on
        LAPACK on
        THREADING Boost
        CACHE_SIZE auto
        VECTORIZATION on
        STORAGE_ORDER rowMajor
        THRESHOLD_DMATDVECMULT 100000UL
        THRESHOLD_SMP_DVECDVECADD 1000000UL
)

Actually, I only changed the blaze cmake output via DEBUG.

When running this cmake reports the following (non-severe) error:

CMake Error at blaze/cmake/Blaze_Import.cmake:175 (file):
  file failed to open for reading (No such file or directory):

    /home/nils-christian/test/blaze/system/Version.h
Call Stack (most recent call first):
  CMakeLists.txt:10 (Blaze_Import)

while looking for the version file. This will trigger some subsequent errors (since files are not found), it does not break anything though.

The problem is the usage of the in-function used ${CMAKE_CURRENT_LIST_DIR} here which will always return the location of the calling CMakeLists.txt file and thus, the path to Version will always be wrong (except if the CMakeLists.txt in blaze root is used).

I fixed that by using the defined variable Blaze_Import_DIR_PATH

      file(READ ${Blaze_Import_DIR_PATH}/../blaze/system/Version.h BLAZE_VERSION_FILE)

instead which I think was meant for that purpose.

I attached my setup in case I did something wrong (there is a folder blaze which for me included the git clone of blaze).

Cheers,

Nils

Comments (5)

  1. Klaus Iglberger

    Hi Nils!

    Thanks for reporting this defect. You are correct, the current implementation is broken. I’ll fix this using your suggestion as quickly as possible. Thanks again,

    Best regards,

    Klaus!

  2. Klaus Iglberger

    Commit 26ed2db fixes the path to the <blaze/system/Version.h> header in the CMakeLists.txt file. The fix is immediately available via cloning the Blaze repository and will be officially released in Blaze 3.9.

  3. Log in to comment