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 5a9f7d3 commit 8333cc3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion unix/vncviewer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,17 @@ execute_process(COMMAND chmod +x vncviewer
include_directories(${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2}
${TJPEG_INCLUDE_DIR})

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
${CMAKE_SOURCE_DIR}/common/turbojpeg-jni/turbojpeg-jni.c)
add_library(turbovnchelper SHARED ${HELPER_SOURCES} usocket.c)
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" ${TJPEG_LIBRARY})
Expand Down

0 comments on commit 8333cc3

Please sign in to comment.