[Libwebsockets] VS2019 static generation

Brice Hamon normandviking at gmail.com
Fri Feb 19 16:09:30 CET 2021


Hi guys,
I spent more time on this problem but unfortunately I was unable to "force"
cmake to use the /MT compilation flag by any means.
It is not a LWS issue IMO but rather a cmake limitation.
I've then used the VS2019 project and changed the flag manually and the
compilation was successful.
So I have a work around for now. We don't so much on windoz so it's not
really a problem for us.
Thank you
Brice.


On Thu, Feb 18, 2021 at 3:03 PM Brice Hamon <normandviking at gmail.com> wrote:

> Hi Andy,
>
> Yes main also has this behavior. The compilation has errors.
>
> I agree with you, it's most likely outside LWS.
> Will do more digging and let you know if I find a workable workaround.
> Hacking generated files to make it work is not really a solution not a
> patch.
>
> I tried with RELEASE and Release. Same outcome.
>
> I'll keep you informed.
> Thank you.
>
>
> On Thu, Feb 18, 2021 at 2:36 PM <andy at warmcat.com> wrote:
>
>> >v4.0-stable
>>
>> Does this problem exist on main?
>>
>> > Then hacking the cmake file but that's not really usable down the line.
>>
>> It is if you send a patch, crazy idea I know.
>>
>> I don't see (on main) anywhere that lws sets /MD, suggesting the problem
>> is outside lws.  But I'm looking on a phone atm, did I miss it?
>>
>> The general approach should be cmake platform-specific stuff adds it,
>> since it knows what to do based on -DCMAKE_BUILD_TYPE=, it's pointless
>> making every cmake project provide that platform-specific knowledge.
>>
>> Is it possible cmake itself cares between "Release" and "RELEASE"?
>>
>> -Andy
>>
>>
>> On February 18, 2021 7:19:27 PM UTC, Brice Hamon <normandviking at gmail.com>
>> wrote:
>> >Hi guys,
>> >
>> >I am recompiling the latest lib v4.0-stable from git, and I am
>> >executing
>> >these 2 commands to compile it:
>> >
>> >cmake -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_BUILD_TYPE=RELEASE
>> >-DLWS_WITH_MINIMAL_EXAMPLES=0 -DLWS_WITH_SHARED=OFF -DLWS_STATIC_PIC=1
>> >-DLWS_WITHOUT_TESTAPPS=1 -DCMAKE_BUILD_TYPE=RELEASE
>> >-DLWS_WITHOUT_DAEMONIZE=1
>> >-DCMAKE_INSTALL_PREFIX:PATH=c:/3rdparty/libwebsockets -G "Visual Studio
>> >10"
>> >..
>> >
>> >cmake --build . --target install --config Release
>> >
>> >The build succeeds but the files are compiled with the /MD flag even if
>> >the
>> >static option is specified.
>> >
>> >My goal is to get a static library compiled with the /MT flag instead
>> >of
>> >the /MD as I am having linking CRT issues when linking with some other
>> >program.
>> >
>> >I spent some time trying with cmake options with no luck.
>> >Then hacking the cmake file but that's not really usable down the line.
>> >
>> >In despair, I found that lws also generate Visual studio projects. I
>> >loaded
>> >them successfully and manually set the option in Release to use /MT and
>> >recompiled it.
>> >Then the link with my other program worked nicely.
>> >
>> >So my question is, is there a supported option to use different CRT?
>> >
>> >It would be great if we could use a CMake option to set up which one to
>> >use
>> >like for example:
>> >-DLWS_USE_CRT_DEBUG=MTd -DLWS_USE_CRT_RELEASE=MT.
>> >Thank you,
>> >Brice.
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20210219/ccaf405a/attachment.htm>


More information about the Libwebsockets mailing list