-
Notifications
You must be signed in to change notification settings - Fork 2
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
Tweak build for QIREE (downstream) #4
Conversation
This creates a version file so that you can specify a version for find_package(XACC), like find_package(XACC 1.0.0). For more info, see: https://cmake.org/cmake/help/latest/command/find_package.html#config-mode-version-selection
set(XACC_VERSION_MAJOR @MAJOR_VERSION@) | ||
set(XACC_VERSION_MINOR @MINOR_VERSION@) | ||
set(XACC_VERSION_PATCH @PATCH_VERSION@) | ||
set(XACC_VERSION_SUFFIX @XACC_BUILD_VERSION@) | ||
set(XACC_VERSION "@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@-@XACC_BUILD_VERSION@") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are set by find_package()
automatically. See the end of this section: https://cmake.org/cmake/help/latest/command/find_package.html#config-mode-version-selection
# file without ${PACKAGE_FIND_VERSION} set, then if() will still get three | ||
# operands. Without the quotes, if() will only get two operands in that case, | ||
# throwing an error. | ||
if(${PACKAGE_VERSION} VERSION_GREATER_EQUAL "${PACKAGE_FIND_VERSION}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if this behavior is right. For reference, here is the LLVMConfigVersion.cmake
on my system:
set(PACKAGE_VERSION "18.1.6")
# LLVM is API-compatible only with matching major.minor versions
# and patch versions not less than that requested.
if("18.1" VERSION_EQUAL
"${PACKAGE_FIND_VERSION_MAJOR}.${PACKAGE_FIND_VERSION_MINOR}"
AND NOT "6" VERSION_LESS "${PACKAGE_FIND_VERSION_PATCH}")
set(PACKAGE_VERSION_COMPATIBLE 1)
if("6" VERSION_EQUAL
"${PACKAGE_FIND_VERSION_PATCH}")
set(PACKAGE_VERSION_EXACT 1)
endif()
endif()
Note that it's doing more careful logic there. If we release XACC 2.0 that breaks everything, then maybe this should not pass (it currently would say "ok, looks compatible to me")
Everything looks good. I wholeheartedly agree with not installing |
I'm working on linking Qwerty with QIREE, but
QIREEConfig.cmake
attempts tofind_package(XACC 1.0.0)
, which is not valid unless there is axacc-config-version.cmake
, which this PR adds. Yes we could tweak QIREE's configuration not to do that, but I think this is a valid usecase for software downstream of XACC.This PR also avoids installing gtest if tests are not being built. If ORNL folks point cmake to
$XACC_DIR
to find gtest when building QIREE (I have no clue if so), then this is a breaking change. (However, I don't thinkmake install
for any software package should install the unit testing framework it uses, in my opinion. Imagine how many different versions of unit testing libraries you'd have in/usr/lib
if that were common practice.)