I've added some functionality from boost::asio
, which has precipitated some compiler "warnings":
Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately.
That problem was dealt with here. I'd like to have CMake detect when I am building on Windows and make the appropriate definitions or command line arguments.
CMake can generate project files for several popular IDEs, such as Microsoft Visual Studio, Xcode, and Eclipse CDT. It can also produce build scripts for MSBuild or NMake on Windows; Unix Make on Unix-like platforms such as Linux, macOS, and Cygwin; and Ninja on both Windows and Unix-like platforms.
Name of the OS CMake is building for. This is the name of the operating system on which CMake is targeting. On systems that have the uname command, this variable is set to the output of uname -s. Linux, Windows, and Darwin for Mac OS X are the values found on the big three operating systems.
CMake is a cross-platform build system generator. Projects specify their build process with platform-independent CMake listfiles included in each directory of a source tree with the name CMakeLists. txt. Users build a project by using CMake to generate a build system for a native tool on their platform.
Inside the CMakeLists.txt file you can do:
IF (WIN32) # set stuff for windows ELSE() # set stuff for other systems ENDIF()
Here is a simple solution.
macro(get_WIN32_WINNT version) if (WIN32 AND CMAKE_SYSTEM_VERSION) set(ver ${CMAKE_SYSTEM_VERSION}) string(REPLACE "." "" ver ${ver}) string(REGEX REPLACE "([0-9])" "0\\1" ver ${ver}) set(${version} "0x${ver}") endif() endmacro() get_WIN32_WINNT(ver) add_definitions(-D_WIN32_WINNT=${ver})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With