How to get caffe version with cmake

145 views
Skip to first unread message

Giulia

unread,
Apr 5, 2016, 8:45:05 AM4/5/16
to Caffe Users

Recently a versioning system has been introduced to Caffe (https://github.com/BVLC/caffe/pull/3311), so that external projects can link to the library and include different headers depending on the version.


How can I retrieve this version in a CMakeLists.txt that links to caffe (or directly in a header file that includes caffe)?


I have tried the following in my CMakeLists.txt:

find_package(Caffe)
include_directories(${Caffe_INCLUDE_DIRS})
add_definitions(${Caffe_DEFINITIONS})
...
get_target_property(version caffe VERSION)
message( STATUS "VERSION is: " ${version})
add_definitions( -DCAFFE_VERSION=${version} )

and it does not find the property. Instead it manages to find:

...
get_target_property(soname caffe IMPORTED_SONAME_RELEASE)
message( STATUS "SONAME is: " ${soname})
add_definitions( -DCAFFE_VERSION=${soname} )

Now I am wondering what is the correct procedure to obtain the CAFFE_VERSION variable defined and usable when I include headers.


Thank you
Giulia
Reply all
Reply to author
Forward
0 new messages