Skip to content

Commit

Permalink
Mac: Fix build with CMake 3.16+
Browse files Browse the repository at this point in the history
CMake 3.16 now includes an OBJC language, so we need to enable that
language rather than fooling CMake into compiling the .m files by
labeling them as C code.
  • Loading branch information
dcommander committed Jan 24, 2024
1 parent c170b3a commit 7cbfe3e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion unix/vncviewer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,15 @@ execute_process(COMMAND chmod +x vncviewer

include_directories(${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2})

if(CMAKE_VERSION VERSION_EQUAL "3.16" OR CMAKE_VERSION VERSION_GREATER "3.16")
enable_language(OBJC)
endif()

set(HELPER_SOURCES turbovnchelper.m JRSwizzle.m)
add_library(turbovnchelper SHARED ${HELPER_SOURCES})
set_source_files_properties(${HELPER_SOURCES} PROPERTIES LANGUAGE C)
if(CMAKE_VERSION VERSION_LESS "3.16")
set_source_files_properties(${HELPER_SOURCES} PROPERTIES LANGUAGE C)
endif()
set_target_properties(turbovnchelper PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/java)
target_link_libraries(turbovnchelper "-framework Cocoa")
Expand Down

0 comments on commit 7cbfe3e

Please sign in to comment.