diff --git a/examples/align/CMakeLists.txt b/examples/align/CMakeLists.txt index b84b12e3ccc..cd1d7bf2ca3 100644 --- a/examples/align/CMakeLists.txt +++ b/examples/align/CMakeLists.txt @@ -9,6 +9,15 @@ if(BUILD_GRAPHICAL_EXAMPLES) add_executable( ${PROJECT_NAME} rs-align.cpp ${IMGUI_SOURCES}) set_property( TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11 ) target_link_libraries( ${PROJECT_NAME} ${DEPENDENCIES} ) +# Check the platform and conditionally link OpenGL and libdl +if(WIN32) + # For Windows, we don't need libdl, use Windows dynamic loading + target_link_libraries(${PROJECT_NAME} OpenGL::GL) +else() + # For non-Windows (Unix-like systems), link OpenGL and libdl + find_package(OpenGL REQUIRED) + target_link_libraries(${PROJECT_NAME} OpenGL::GL dl) +endif() include_directories( ../../third-party/imgui ../../examples ) set_target_properties( ${PROJECT_NAME} PROPERTIES FOLDER Examples ) using_easyloggingpp( ${PROJECT_NAME} SHARED )