diff --git a/light/CMakeLists.txt b/light/CMakeLists.txt index e706ad7a..26b48559 100644 --- a/light/CMakeLists.txt +++ b/light/CMakeLists.txt @@ -60,7 +60,7 @@ target_link_libraries (light PRIVATE ${CMAKE_THREAD_LIBS_INIT}) if (embree_FOUND) target_link_libraries (light PRIVATE embree) add_definitions(-DHAVE_EMBREE) - + find_file(EMBREE_LICENSE LICENSE.txt "${embree_DIR}/doc" "${embree_DIR}/../embree3/embree3" # vcpkg puts it here @@ -72,48 +72,18 @@ if (embree_FOUND) message(STATUS "Found embree license: ${EMBREE_LICENSE}") endif() - if(WIN32) - file(GLOB EMBREE_DLLS "${embree_DIR}/bin/*.dll") - foreach(EMBREE_DLL ${EMBREE_DLLS}) - add_custom_command(TARGET light POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${EMBREE_DLL} $) - endforeach(EMBREE_DLL) - - add_custom_command(TARGET light POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${EMBREE_LICENSE} $/LICENSE-embree.txt) + add_custom_command(TARGET light POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "${EMBREE_LICENSE}" "$/LICENSE-embree.txt") - install(FILES ${EMBREE_DLLS} DESTINATION bin) - endif() - if(UNIX) - if (APPLE) - set(SHARED_LIB_EXT dylib) - elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") - set(SHARED_LIB_EXT "so.*") - else () - message(FATAL_ERROR "only Linux and macOS currently supported") - endif() - - - file(GLOB EMBREE_DYLIBS_WITH_SYMLINKS "${embree_DIR}/lib/*.${SHARED_LIB_EXT}") - - # Gather all .dylib's that are not symlinks - foreach(EMBREE_DYLIB ${EMBREE_DYLIBS_WITH_SYMLINKS}) - if(NOT IS_SYMLINK ${EMBREE_DYLIB}) - list(APPEND EMBREE_DYLIBS ${EMBREE_DYLIB}) - endif() - endforeach() - - foreach(EMBREE_DYLIB ${EMBREE_DYLIBS}) - message(STATUS "Copying dylib: ${EMBREE_DYLIB}") - add_custom_command(TARGET light POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${EMBREE_DYLIB} $) - endforeach() - - # so the executable will search for dylib's in the same directory as the executable - if(APPLE) - add_custom_command(TARGET light POST_BUILD COMMAND bash ARGS -c \"install_name_tool -add_rpath @loader_path $ || true\") - endif() - - install(FILES ${EMBREE_DYLIBS} DESTINATION bin) + # so the executable will search for dylib's in the same directory as the executable + if(APPLE) + add_custom_command(TARGET light POST_BUILD + COMMAND bash ARGS -c \"install_name_tool -add_rpath @loader_path $ || true\") endif() + install(FILES "$" "$" DESTINATION bin) install(FILES ${EMBREE_LICENSE} DESTINATION bin RENAME LICENSE-embree.txt) endif(embree_FOUND)