mirror of
https://github.com/jmcnamara/libxlsxwriter.git
synced 2026-05-15 14:15:54 -06:00
[GH-ISSUE #177] Don't hardcode msvc runtime library in cmake file #143
Labels
No labels
awaiting user feedback
bug
cmake
cmake
docs
feature request
in progress
long term
medium term
medium term
pull-request
question
question
ready to close
short term
under investigation
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/libxlsxwriter#143
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @dirkvdb on GitHub (May 15, 2018).
Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/177
Originally assigned to: @jmcnamara on GitHub.
When compiling with MSVC the runtime settings are hard coded in the CMakeLists.txt
This is bad practice, these settings should be defined in a toolchain file, never hardcoded in the cmake file.
When i want to compile the library using a different runtime for inclusion in my project the only option I have is patching the CMakeLists.txt
@jmcnamara commented on GitHub (May 15, 2018):
@Alexhuszagh can you have a look at this as well.
@jmcnamara commented on GitHub (May 16, 2018):
@dirkvdb If you know how to fix this and can submit a PR then that would be good.
@dirkvdb commented on GitHub (May 16, 2018):
I created a pull request, all it does is remove the hardcoded runtime flags.
@jmcnamara commented on GitHub (May 16, 2018):
For reference: PR #178
@jmcnamara commented on GitHub (May 16, 2018):
@RalfKubis Any thoughts on this?
@Alexhuszagh commented on GitHub (May 17, 2018):
@dirkvdb It is bad practice, but greatly simplifies life for simple cases.
@jmcnamara They're right, and I would likely accept the PR.
I can document toolchain configurations (although manually providing them is likely beyond the scope of this project, although I would gladly do so) inside the CMakeLists as a follow-up PR.
@dirkvdb commented on GitHub (May 17, 2018):
@Alexhuszagh
It would be better to do:
string(REPLACE "/MD" "/MT" ${CMAKE_C_FLAGS} "${${CMAKE_C_FLAGS}}")FORCE_STATIC_MSVC_RUNTIME, that way you can get the current behaviour without messing with toolchains.@Alexhuszagh commented on GitHub (May 17, 2018):
@dirkvdb I entirely agree, also, this is not my code in question. We may want to ask @jimzshi what he thinks, since he authored the PR.
I think we should wait for feedback from him, but I agree this is peculiar, and also not best practice. Options sound like a great way, but this does honestly sound like something for a toolchain.
For reference:
https://github.com/jmcnamara/libxlsxwriter/pull/103
9a78c323a9 (diff-af3b638bc2a3e6c650974192a53c7291)@jimzshi commented on GitHub (May 18, 2018):
@Alexhuszagh @dirkvdb
i have no objections removing runtime lib from cmakefile.
imho both approach has its up/down sides in different scenarios. at this stage, i reckon @dirkvdb proposal is better since it provides more flexibility to the lib compilation.
i also think it would be even better if @dirkvdb can at meanwhile provide cmake options that lib users can choose runtime lib as they wish. many thanks in advance.
cheers.
@jmcnamara commented on GitHub (May 21, 2018):
Merged. Thanks.