Conversation
|
Hi! @KjellKod Please don't merge yet. I just want to make sure that CPack works well after this PR. |
|
To further improve this change and to make it more robust please consider:
|
|
@myd7349 : any progress on this one? |
|
Hi! @KjellKod Sorry for the delay! I will finish it as soon as possible. |
|
I have done some tests about According to the tests: IF(NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
SET(CPACK_PACKAGING_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
ELSEIF(NOT CPACK_PACKAGING_INSTALL_PREFIX)
SET(CPACK_PACKAGING_INSTALL_PREFIX /usr/local)
ENDIF()will cause IF(NOT MINGW)
INSTALL( TARGETS g3logger
ARCHIVE DESTINATION ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}
COMPONENT libraries)
INSTALL( FILES ${HEADER_FILES}
DESTINATION ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_HEADERDIR}
COMPONENT headers)
INSTALL( FILES ${PROJECT_SOURCE_DIR}/cmake/g3loggerConfig.cmake
DESTINATION ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/cmake/g3logger)
ELSE()
INSTALL( TARGETS g3logger
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT libraries)
INSTALL( FILES ${HEADER_FILES}
DESTINATION ${CMAKE_INSTALL_HEADERDIR}
COMPONENT headers)
INSTALL( FILES ${PROJECT_SOURCE_DIR}/cmake/g3loggerConfig.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/g3logger)
ENDIF()can be simplified as: INSTALL( TARGETS g3logger
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT libraries)
INSTALL( FILES ${HEADER_FILES}
DESTINATION ${CMAKE_INSTALL_HEADERDIR}
COMPONENT headers)
INSTALL( FILES ${PROJECT_SOURCE_DIR}/cmake/g3loggerConfig.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/g3logger)The test result also shows that: cmake .. -DCMAKE_INSTALL_PREFIX=<one value> -DCPACK_PACKAGING_INSTALL_PREFIX=<another value>will not properly. To fix this problem, we may change these lines to: IF(NOT CPACK_PACKAGING_INSTALL_PREFIX)
IF(NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
SET(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
ELSE()
SET(CPACK_PACKAGING_INSTALL_PREFIX /usr/local)
ENDIF()
ENDIF() |
|
Cool. That sounds like an amazing improvement. Please comment when you are ready for a re-review |
|
@myd7349 : Please consider adding a section to the readme for the build/install options |
|
@myd7349 your example [link] seem to be using
|
|
Oh! Sorry. That's a shame. I have tested it again: https://github.com/myd7349/Ongoing-Study/blob/master/cpp/CMake/libfoo_v2/README.md
Sure. |
|
Hi! @KjellKod As of the last commit, I think I have finished this PR. Could you give it a review again? |
README.markdown
Outdated
| You may also specify one or more of those options listed above from the command line. | ||
| For example, on Windows: | ||
| ``` | ||
| cmake .. -G "Visual Studio 15 2017" -DG3_SHARED_LIB=OFF -DCMAKE_INSTALL_PREFIX=C:/g3log -DADD_G3LOG_UNIT_TEST=ON -DADD_FATAL_EXAMPLE=OFF |
README.markdown
Outdated
| ``` | ||
| This will install g3log to `/usr` instead of `/usr/local`. | ||
|
|
||
| Package maintainers may be interested in the `CPACK_PACKAGING_INSTALL_PREFIX`. For example: |
There was a problem hiding this comment.
nit: Make it clear that this does not work on Windows.
Ref: your testing that shows that specifying CPACK_PACKAGING_INSTALL_PREFIX fails with cpack.
Suggestion:
Package maintainers
-> *nix* package maintainers or
-> Linux/OSX package maintainers
README.markdown
Outdated
| ## Configuring | ||
| g3log provides following CMake options (and default values): | ||
| ``` | ||
| $ cmake -LAH |
There was a problem hiding this comment.
Super! Didn’t know you could trigger a listing of all the variables.
nit: explain above the command in a one liner what cmake -LAH is
There was a problem hiding this comment.
It doesn’t hurt to mention Options.cmake
Suggestion: something like
List all of g3log’s cmake options to see configuration choices.
For additional option context and comments please also see [Options.cmake](https://github.com/KjellKod/g3log/blob/master/Options.cmake)
*Generate listing of all of g3log’s CMake variables:*
`cmake-LAH`
There was a problem hiding this comment.
One more commit is added. And the second sentence is added after those options.
1f96aac to
89ae2f8
Compare
KjellKod
left a comment
There was a problem hiding this comment.
Detailed. To the point and overall a Great improvement.
Approved, pending testing before merging
|
@myd7349 Thanks |
|
Yes. I think this PR is more better after the last two commits. Please review it again. :) |
|
Thanks. I have not forgotten about this but work-life balance has been off lately. |
KjellKod
left a comment
There was a problem hiding this comment.
Can you verify if there is an : OSX issue on the generated target file.
|
Nice work @myd7349! thanks |
I am trying to add
g3logtovcpkg: microsoft/vcpkg#5961 these days, and encountered some issues:installtarget on Win32g3loggerConfig.cmakedoesn't work out on Win32g3loggerConfig.cmakeonly takes care ofSHAREDlibrary