Reputation: 1245
There is a header-only C++ library.
When I use write_basic_package_version_file()
,
to create ...ConfigVersion.cmake file,
not only version is checked but also 32/64 bitness compatibility:
# if the installed or the using project don't
# have CMAKE_SIZEOF_VOID_P set, ignore it:
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "")
return()
endif()
# check that the installed version has the
# same 32/64bit-ness as the one which is currently searching:
if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "8")
math(EXPR installedBits "8 * 8")
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
endif()
This doesn't have any sense for header-only lib. I can delete that code manually, but is there an elegant way not to generate this "addition"?
Upvotes: 0
Views: 280
Reputation: 2060
If you project unset the variable CMAKE_SIZEOF_VOID_P
(or set to an empty string) before calling write_basic_package_version_file()
this would ensure the check for bitness is disabled.
Indeed, the following snippet used on all BasicConfigVersion-*.in
templates:
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
return()
endif()
would be configured as
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "" STREQUAL "")
return()
endif()
and always return.
Upvotes: 1