Introduction
The Windows versions of the POCO C++ Libraries are built with CMake and Visual Studio. Basic support for building with MinGW is there as well, but at this time is not officially supported and may or may not work.
The following build configurations are available:
- Debug/Release with BUILD_SHARED_LIBS=ON: dynamic link libraries (DLL) with DLL C/C++ runtime libraries (/MD).
- Debug/Release with BUILD_SHARED_LIBS=OFF: static libraries with DLL C/C++ runtime libraries (/MD).
- Debug/Release with BUILD_SHARED_LIBS=OFF and POCO_MT=ON: static libraries with static C/C++ runtime libraries (/MT).
Libraries And Linking Considerations
Automatic Linking of POCO C++ Libraries
The POCO C++ Libraries header files contain #pragma comment directives that enable automatic linking of the required POCO libraries to an application. For this to work, a few rules must be kept in mind.
- The default is to link the POCO C++ Libraries dynamically (DLL).
- To link statically, the code using the POCO C++ Libraries must be compiled with the preprocessor symbol POCO_STATIC defined. CMake sets this automatically when building with BUILD_SHARED_LIBS=OFF.
Library Naming Conventions
The following naming conventions are used:
- DLL import libraries are named PocoLIB.lib for the release build and PocoLIBd.lib for the debug build.
- Static libraries built using the static multithreaded C/C++ runtime libraries are named PocoLIBmt.lib (release) and PocoLIBmtd.lib (debug).
- Static libraries built using the DLL C/C++ runtime libraries are named PocoLIBmd.lib (release) and PocoLIBmdd.lib (debug).
With CMake, libraries and executables are placed in the build directory. The exact location depends on the generator and configuration used.
MSVC Compiler Notes
C++ standard version
MSVC does not correctly report the C++ standard version via the __cplusplus macro by default. The /Zc:__cplusplus compiler flag is required to fix this. CMake sets this flag automatically when building the POCO C++ Libraries.
See the following issues for details and explanations:
- https://github.com/pocoproject/poco/issues/3665
- https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/