Two new CMake and Visual Studio related features

38 views
Skip to first unread message

Albrecht Schlosser

unread,
Nov 25, 2023, 5:16:01 PM11/25/23
to fltkg...@googlegroups.com
All,

I committed two new features that can make life easier when building and
testing FLTK on Windows.

1) New CMake option to select the MSVC runtime version, either DLL or
static.

This is known as compile/build switches /MT, /MTd, /MD, or /MDd. The
CMake option is documented in README.CMake.txt:
```
FLTK_MSVC_RUNTIME_DLL - default ON (only for Visual Studio and NMake).
   Selects whether the build uses the MS runtime DLL or not.
   Default is ON: either /MD or /MDd for Release or Debug, respectively.
   Select OFF for either /MT or /MTd for Release or Debug, respectively.
```

Note: the previously documented CMake command lines for NMake including
```
-DCMAKE_CXX_FLAGS_RELEASE="/MT /O2 /Ob2 /D NDEBUG"
-DCMAKE_C_FLAGS_RELEASE="/MT /O2 /Ob2 /D NDEBUG"
```

are NOT recommended and will be removed from the README file. The above
settings are problematic because they set different types of
options/compiler switches.

These options should be replaced by "-DFLTK_MSVC_RUNTIME_DLL=OFF" which
should be sufficient.

@Greg: AFAICT you were using this for your NMake builds. I'd appreciate
feedback.


2) The second improvement is for testing FLTK test and demo programs in
the Visual Studio IDE. I added a new CMake feature to extend the PATH
environment variable when the debugger is started so the FLTK DLL is
found automatically w/o copying DLL's to the program build folders.
There's nothing you need to do, this is just to let you know and it
applies only to builds that enable FLTK shared builds (e.g.
hello-shared.exe).

Hint: if anybody wants to use this for their own builds: look for
`VS_DEBUGGER_ENVIRONMENT` in the CMake code.

Reply all
Reply to author
Forward
0 new messages