Skip to content

Commit

Permalink
Merge pull request #2455 from hundeboll/nominmax
Browse files Browse the repository at this point in the history
cmake: disable min() and max() macros in windows.h
  • Loading branch information
jhasse authored May 28, 2024
2 parents a58bf70 + b332497 commit 8aa51b2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ if(WIN32)
# so that build environments which lack a C compiler, but have a C++
# compiler may build ninja.
set_source_files_properties(src/getopt.c PROPERTIES LANGUAGE CXX)

# windows.h defines min() and max() which conflict with std::min()
# and std::max(), which both might be used in sources. Avoid compile
# errors by telling windows.h to not define those two.
add_compile_definitions(NOMINMAX)
else()
target_sources(libninja PRIVATE src/subprocess-posix.cc)
if(CMAKE_SYSTEM_NAME STREQUAL "OS400" OR CMAKE_SYSTEM_NAME STREQUAL "AIX")
Expand Down

0 comments on commit 8aa51b2

Please sign in to comment.