-
Notifications
You must be signed in to change notification settings - Fork 136
build cMocka lib manually to VCPKG #875
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -77,7 +77,21 @@ function(ADD_CMOCKA_TEST _TARGET_NAME) | |||||
| endif() | ||||||
|
|
||||||
| if(DEFINED ENV{VCPKG_ROOT} OR DEFINED ENV{VCPKG_INSTALLATION_ROOT}) | ||||||
| set(CMOCKA_LIB ${CMOCKA_LIBRARIES}) | ||||||
| if(DEFINED ENV{VCPKG_ROOT}) | ||||||
| set(VCPKG_PATH $ENV{VCPKG_ROOT}) | ||||||
| endif() | ||||||
| if(DEFINED ENV{VCPKG_INSTALLATION_ROOT}) | ||||||
| set(VCPKG_PATH "$ENV{VCPKG_INSTALLATION_ROOT}/") | ||||||
| endif() | ||||||
|
|
||||||
| # Patch for new VCPKG cmocka returning relative path | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will we revert this once VCPKG issue is fixed (or maybe after the version pinning changes that @danieljurek was considering)?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah, this is a temporal fix. I am not sure if there is a bug for VCPKG, it might be that it used to be one and they fixed it and we were just making it work by luck wrongly before. but, at any way, we need follow up on this
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thank you @danewalton . So, as soon as VCPKG fix is merged, we can revert the changes here and it should work the same (and better without the hardcoded hot fix) |
||||||
| if(MSVC) | ||||||
| set(CMOCKA_STATIC_LIB "/lib/cmocka-static.lib") | ||||||
| else() | ||||||
| set(CMOCKA_STATIC_LIB "/lib/libcmocka-static.a") | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Question: Is the name of the
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it is .a on Posix (lin/mac) and .lib on windows. the expectation is that cmoka will use whatever is loaded on ${CMOCKA_LIBRARIES}. That variable is provided by VCPKG when cmocka is installed. Cmocka provides the scripts to VCPKG to generate this variable. In the past, this variable was generated like: So the prefix path to the libraries was removed from both, debug and optimized libs. I am just manually building the value we used to have before |
||||||
| endif() | ||||||
| set(CMOCKA_PREFIX "${VCPKG_PATH}installed/${VCPKG_TARGET_TRIPLET}") | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Question: Does this need a directory separator?
Suggested change
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no, VCPKG_PATH is expected to have the |
||||||
| set(CMOCKA_LIB "debug;${CMOCKA_PREFIX}/debug${CMOCKA_STATIC_LIB};optimized;${CMOCKA_PREFIX}${CMOCKA_STATIC_LIB}") | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Question: How did you know this is what we need to set I am trying to understand what this means.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no, Then, depending on what cmake is building, it will pick debug or optimized. Then one on optimized does not have the |
||||||
| else() | ||||||
| set(CMOCKA_LIB cmocka) | ||||||
| endif() | ||||||
|
|
||||||
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.
Is the
/at the end of the string intentional? Why don't we have the same thing above, inset(VCPKG_PATH $ENV{VCPKG_ROOT})Also, is that why we surround it in quotes?
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.
it is intentional.
In the above lines, (usually Linux and Windows) the VCPK_ROOT includes the
/at the end of the pathFor VCPK_INSTALLATION_ROOT (Mac) the
/is missing, that's why we add it.the quotes are just required in the second one to make the concatenation. Above lines we don't need to