Skip to content
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

Enhanced static library presentation within CMake projects #705

Open
jld01 opened this issue Feb 11, 2024 · 0 comments
Open

Enhanced static library presentation within CMake projects #705

jld01 opened this issue Feb 11, 2024 · 0 comments

Comments

@jld01
Copy link
Contributor

jld01 commented Feb 11, 2024

The default CMake behaviour for GNU toolchains will build static libraries using ar qc followed by ranlib. This recipe does not support the archive presentation improvements introduced in #630. I have been able to demonstrate the enhanced presentation in the context of a CDT CMake project by adding the following CMake commands:

# create archives with index and full path information
set(CMAKE_ASM_ARCHIVE_CREATE "<CMAKE_AR> qcsP <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> qcsP <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> qcsP <TARGET> <LINK_FLAGS> <OBJECTS>")
# append to archives with index and full path information
set(CMAKE_ASM_ARCHIVE_APPEND "<CMAKE_AR> qsP <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_C_ARCHIVE_APPEND "<CMAKE_AR> qsP <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> qsP <TARGET> <LINK_FLAGS> <OBJECTS>")
# do not invoke ranlib - it removes full path information
set(CMAKE_ASM_ARCHIVE_FINISH "")
set(CMAKE_C_ARCHIVE_FINISH "")
set(CMAKE_CXX_ARCHIVE_FINISH "")

Should we provide some sort of "CDT support" CMake file for those users who want to take advantage of the enhanced presentation? This could be part of the project, to allow use from other IDEs or the command line, and enabled by default via a command in the CMakeLists.txt file such as include(CDTsupport.cmake OPTIONAL). Ideally, there would be an easy way to add this support to CMake projects imported into CDT from elsewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant