GithubHelp home page GithubHelp logo

Comments (4)

rdementi avatar rdementi commented on August 19, 2024

Thanks for the suggestion. The change was introduced to reduce the risks of DLL hijacking.

Would you be able to submit a pull request with a CMakeLists.txt change to specify the runtime using the built-in variables and properties?

from pcm.

artiomn avatar artiomn commented on August 19, 2024

Perhaps reducing the risk of DLL hijacking is the responsibility of the application developer?

Several compilers. I'm porting framework to Windows from Linux.
Ideally, I should not specify runtime, and everything should be built "out of the box", like in Linux.

But neither MSVS 19 nor MSVS 2022 was able to build due to linking errors.

And I must to set only static MT runtime to build.

This gives rise to several problems:

  • It's difficult.
  • Using this runtime generates errors when deleting objects (I don't want to debug this).
  • I cannot use pre-built libraries, were built with a different runtime.

I just commented lines with target_compile_options(PCM_STATIC PRIVATE "/MT$<$<CONFIG:Debug>:d>").

Correct "CMake-style way" to change runtime is using MSVC_RUNTIME_LIBRARY property, i.e.:

if (MSVC)  # AND ($<COMPILE_LANGUAGE> STREQUAL CXX OR $<COMPILE_LANGUAGE> STREQUAL C))
        set_property(TARGET "${target}" PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
    endif()

And variable to set runtime: set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL").

But, please, don't specify runtime in the library.

from pcm.

rdementi avatar rdementi commented on August 19, 2024

thanks for the recipe. We will evaluate it. As a work-around we can offer a new -DNO_STATIC_MSVC_RUNTIME_LIBRARY=1 option which you can use with cmake when compiling pcm.

from pcm.

artiomn avatar artiomn commented on August 19, 2024

Thank you. It's better than nothing. But if you have a real reason to set the runtime library (like formal SDL requirements), perhaps in the future it would be better to add an option where the user can set an arbitrary runtime?

from pcm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.