|
1 | 1 | #################################################################################################### |
2 | 2 | # This file is a part of PyPartMC licensed under the GNU General Public License v3 (LICENSE file) # |
3 | | -# Copyright (C) 2022 University of Illinois Urbana-Champaign # |
4 | | -# Author: Sylwester Arabas # |
| 3 | +# Copyright (C) 2022-2025 University of Illinois Urbana-Champaign # |
| 4 | +# Author: PyPartMC developers (https://github.com/open-atmos/PyPartMC/graphs/contributors) # |
5 | 5 | #################################################################################################### |
6 | 6 |
|
7 | 7 | cmake_minimum_required(VERSION 3.15) # CXX17 |
@@ -566,32 +566,32 @@ file(GLOB PyPartMC_headers ${CMAKE_SOURCE_DIR}/src/*.hpp) |
566 | 566 | if (NOT "${CMAKE_REQUIRED_INCLUDES}" STREQUAL "") |
567 | 567 | message("CMAKE_REQUIRED_INCLUDES not empty! (${CMAKE_REQUIRED_INCLUDES})") |
568 | 568 | endif() |
569 | | -# foreach(file ${PyPartMC_headers}) |
570 | | -# set(CMAKE_REQUIRED_INCLUDES "${PYPARTMC_INCLUDE_DIRS};${pybind11_INCLUDE_DIRS}") |
571 | | -# set(CMAKE_REQUIRED_FLAGS "-Werror") |
572 | | -# string(REGEX REPLACE "[\-./:]" "_" file_var ${file}) |
573 | | -# check_cxx_source_compiles(" |
574 | | -# // https://github.com/nlohmann/json/issues/1408 |
575 | | -# #if defined(_WIN32) || defined(_WIN64) |
576 | | -# # define HAVE_SNPRINTF |
577 | | -# #endif |
578 | | -# #include \"${file}\" |
579 | | -# int main() { return 0;} |
580 | | -# " |
581 | | -# _header_self_contained_${file_var} |
582 | | -# ) |
583 | | -# unset(CMAKE_REQUIRED_INCLUDES) |
584 | | -# unset(CMAKE_REQUIRED_FLAGS) |
585 | | -# if (NOT _header_self_contained_${file_var}) |
586 | | -# message(SEND_ERROR "non-self-contained header: ${file}") |
587 | | -# if (${CMAKE_VERSION} VERSION_LESS "3.26.0") |
588 | | -# file(READ "${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log" tmp) |
589 | | -# else() |
590 | | -# file(READ "${CMAKE_BINARY_DIR}/CMakeFiles/CMakeConfigureLog.yaml" tmp) |
591 | | -# endif() |
592 | | -# message(FATAL_ERROR ${tmp}) |
593 | | -# endif() |
594 | | -# unset(file_var) |
595 | | -# endforeach() |
| 569 | +foreach(file ${PyPartMC_headers}) |
| 570 | + set(CMAKE_REQUIRED_INCLUDES "${PYPARTMC_INCLUDE_DIRS};${Python_INCLUDE_DIRS}") |
| 571 | + set(CMAKE_REQUIRED_FLAGS "-Werror") |
| 572 | + string(REGEX REPLACE "[\-./:]" "_" file_var ${file}) |
| 573 | + check_cxx_source_compiles(" |
| 574 | + // https://github.com/nlohmann/json/issues/1408 |
| 575 | + #if defined(_WIN32) || defined(_WIN64) |
| 576 | + # define HAVE_SNPRINTF |
| 577 | + #endif |
| 578 | + #include \"${file}\" |
| 579 | + int main() { return 0;} |
| 580 | + " |
| 581 | + _header_self_contained_${file_var} |
| 582 | + ) |
| 583 | + unset(CMAKE_REQUIRED_INCLUDES) |
| 584 | + unset(CMAKE_REQUIRED_FLAGS) |
| 585 | + if (NOT _header_self_contained_${file_var}) |
| 586 | + message(SEND_ERROR "non-self-contained header: ${file}") |
| 587 | + if (${CMAKE_VERSION} VERSION_LESS "3.26.0") |
| 588 | + file(READ "${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log" tmp) |
| 589 | + else() |
| 590 | + file(READ "${CMAKE_BINARY_DIR}/CMakeFiles/CMakeConfigureLog.yaml" tmp) |
| 591 | + endif() |
| 592 | + message(FATAL_ERROR ${tmp}) |
| 593 | + endif() |
| 594 | + unset(file_var) |
| 595 | +endforeach() |
596 | 596 |
|
597 | 597 | _install(TARGETS _PyPartMC LIBRARY DESTINATION PyPartMC) |
0 commit comments