Skip to content

Commit

Permalink
Fix cygwin build
Browse files Browse the repository at this point in the history
  • Loading branch information
beutlich committed Jan 27, 2024
1 parent bd96aaf commit 9d72621
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
5 changes: 3 additions & 2 deletions Modelica/Resources/BuildProjects/CMake/src.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ if(HAVE_FTELLO64)
endif()

if(UNIX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -Wno-attributes -fno-delete-null-pointer-checks")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g -Wno-attributes -fno-delete-null-pointer-checks")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -O3 -Wno-attributes -fno-delete-null-pointer-checks")
elseif(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS /W3)
endif()
Expand Down Expand Up @@ -138,7 +139,7 @@ endif()
if(MODELICA_DUMMY_FUNCTION_USERTAB OR BUILD_TESTING)
target_compile_definitions(ModelicaStandardTables PRIVATE -DDUMMY_FUNCTION_USERTAB=1)
endif()
if(MODELICA_BUILD_ZLIB AND (HAVE_WINAPIFAMILY_H OR HAVE_IO_H))
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)
Expand Down
13 changes: 9 additions & 4 deletions Modelica/Resources/BuildProjects/CMake/test.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,18 @@ if(BUILD_TESTING)
)
foreach(TEST ${MODELICA_TESTS})
add_executable(Test${TEST} "${ABSOLUTE_MODELICA_TEST_SOURCE_DIR}/${TEST}.c")
target_link_libraries(Test${TEST} ModelicaExternalC ModelicaStandardTables ModelicaIO ModelicaMatIO zlib)
target_link_libraries(Test${TEST} ModelicaExternalC ModelicaStandardTables ModelicaIO ModelicaMatIO)
if(MODELICA_BUILD_ZLIB)
target_link_libraries(Test${TEST} zlib)
else()
target_link_libraries(Test${TEST} z)
endif()
add_test(NAME Test${TEST} COMMAND Test${TEST} WORKING_DIRECTORY "${ABSOLUTE_MODELICA_TEST_SOURCE_DIR}")
endforeach()
else()
message(WARNING
" Testsuite not found in \"${ABSOLUTE_MODELICA_TEST_SOURCE_DIR}\"."
" Set BUILD_TESTING to OFF to silence this warning."
)
" Testsuite not found in \"${ABSOLUTE_MODELICA_TEST_SOURCE_DIR}\"."
" Set BUILD_TESTING to OFF to silence this warning."
)
endif()
endif()

0 comments on commit 9d72621

Please sign in to comment.