I was trying to migrate my environment to CMAKE to use GCC compiler with VS.
Previously I are using make script.
Can any one support me on how to generate the below make command in the CMAKE script. In the below make command we are generating the .a .dll and stripped .a and .dll
type $(OUTDIR)/$(PROJ).dll: $(OBJECTS)
@$(ECHO) Linking and locating to $(PROJ).dll
@$(BINDIR)/gcc -shared -Wl,-Map=$(OUTDIR)/$(PROJ).map -o$(OUTDIR)/$(PROJ).dll $(OPT_LC) @objects.txt
@$(BINDIR)/strip -s -o $(OUTDIR)/$(PROJ)_stripped.dll $(OUTDIR)/$(PROJ).dll
@$(ECHO) Creating $(PROJ).a
@$(shell $(RM) -f $(OUTDIR)/$(PROJ).a)
@$(BINDIR)/ar r $(OUTDIR)/$(PROJ).a @objects.txt
@$(BINDIR)/strip -g -X -x -o $(OUTDIR)/$(PROJ)_stripped.a $(OUTDIR)/$(PROJ).aor paste code here
CMake tends to strip on the
install step rather than right after linking. However, you can use
add_custom_command(POST_LINK) to do post-link steps like this (though I don’t think CMake exposes any “how to strip a library” abstraction to make it really easy).
cmake --install --strip example
cmake -S . -B build/ ...
cmake --build build/ ...
# Install binaries
cmake --install build/ --prefix build/unstripped ...
# Install stripped binaries
cmake --install build/ --prefix build/stripped --strip...
I personally like the way CMake handles this. Since it gives more flexibility via the CLI to users.
I was using Visual Studio is it possible to to install it in VS.?
If it is a CLI I hope that would be straightforward. I am not sure weather it comes by default with VS or we need to install it manually
I suppose an
install/strip target in VS might make sense… Might be worth an issue if the functionality isn’t hiding somewhere already.