Skip to content

Commit

Permalink
Fix CMake config
Browse files Browse the repository at this point in the history
* Do not expose ZLIB_INCLUDE_DIR to all targets
* Fix build with VS 17.10
  • Loading branch information
beutlich committed Aug 1, 2024
1 parent 4bf008d commit c592152
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function(get_modelica_platform_name_with_compiler_version var)
set(PLATFORM_PATH_SUFFIX "${PLATFORM_PATH_SUFFIX}/vs2017")
elseif(MSVC_VERSION GREATER_EQUAL 1920 AND MSVC_VERSION LESS 1930)
set(PLATFORM_PATH_SUFFIX "${PLATFORM_PATH_SUFFIX}/vs2019")
elseif(MSVC_VERSION GREATER_EQUAL 1930 AND MSVC_VERSION LESS 1940)
elseif(MSVC_VERSION GREATER_EQUAL 1930 AND MSVC_VERSION LESS 1950)
set(PLATFORM_PATH_SUFFIX "${PLATFORM_PATH_SUFFIX}/vs2022")
endif()
endif()
Expand Down
4 changes: 1 addition & 3 deletions Modelica/Resources/BuildProjects/CMake/src.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,16 @@ set(MODELICA_SOURCE_DIR "${MODELICA_RESOURCES_DIR}/C-Sources")
if(MODELICA_BUILD_ZLIB)
set(ZLIB_INCLUDE_DIR "${MODELICA_SOURCE_DIR}/zlib")
file(TO_CMAKE_PATH ${ZLIB_INCLUDE_DIR} ZLIB_INCLUDE_DIR)
include_directories(${ZLIB_INCLUDE_DIR})
elseif(DEFINED ZLIB_INCLUDE_DIR)
if(NOT ZLIB_INCLUDE_DIR STREQUAL "")
file(TO_CMAKE_PATH ${ZLIB_INCLUDE_DIR} ZLIB_INCLUDE_DIR)
include_directories(${ZLIB_INCLUDE_DIR})
else()
message(FATAL_ERROR "ZLIB_INCLUDE_DIR is an empty string.")
endif()
else()
set(ZLIB_INCLUDE_DIR "" CACHE PATH "Include directory of the zlib.h header file")
if(NOT ZLIB_INCLUDE_DIR STREQUAL "")
file(TO_CMAKE_PATH ${ZLIB_INCLUDE_DIR} ZLIB_INCLUDE_DIR)
include_directories(${ZLIB_INCLUDE_DIR})
else()
message(FATAL_ERROR "ZLIB_INCLUDE_DIR is an empty string.")
endif()
Expand Down Expand Up @@ -144,6 +141,7 @@ if(MODELICA_BUILD_ZLIB AND (HAVE_WINAPIFAMILY_H OR HAVE_IO_H) AND NOT CYGWIN)
target_compile_definitions(zlib PRIVATE -DWINAPI_FAMILY=100)
endif()
target_compile_definitions(ModelicaMatIO PRIVATE -DHAVE_ZLIB=1)
target_include_directories(ModelicaMatIO PRIVATE ${ZLIB_INCLUDE_DIR})
if(MSVC)
target_compile_options(ModelicaMatIO PRIVATE /wd4267)
endif()
Expand Down

0 comments on commit c592152

Please sign in to comment.