From 485d90bef128967c613c5a59d83cf9c7a739d750 Mon Sep 17 00:00:00 2001 From: Cary Phillips Date: Sat, 10 Feb 2024 14:05:09 -0800 Subject: [PATCH] Fix install of symlink (#1633) PR #1624 caused the .so symlink without the `OPENEXR_LIB_SUFFIX` (e.g. libOpenEXR.so which links to libOpenEXR-3_2.so) to get created in the wrong directory. This caused certain invocations of cmake to fail, even though the invocation in the CI succeeded. It's not at all clear why. This also changes the CI to invoke cmake in the way that previously failed (e.g. from the top-level directory with `-B` and `-S`), as an additional check. Signed-off-by: Cary Phillips --- .github/workflows/ci_workflow.yml | 8 +++----- cmake/LibraryDefine.cmake | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci_workflow.yml b/.github/workflows/ci_workflow.yml index 3aac7583e8..bc51851d7e 100644 --- a/.github/workflows/ci_workflow.yml +++ b/.github/workflows/ci_workflow.yml @@ -238,8 +238,8 @@ jobs: run: yum install -y help2man - name: Configure run: | - cmake .. \ - -DCMAKE_INSTALL_PREFIX=../_install \ + cmake -B _build -S . \ + -DCMAKE_INSTALL_PREFIX=_install \ -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \ -DCMAKE_CXX_STANDARD=${{ matrix.cxx-standard }} \ -DCMAKE_CXX_FLAGS=${{ matrix.cxx-flags }} \ @@ -249,13 +249,11 @@ jobs: -DOPENEXR_INSTALL_DOCS='ON' \ -DOPENEXR_RUN_FUZZ_TESTS='OFF' \ -DOPENEXR_ENABLE_THREADING=${{ matrix.threads-enabled }} - working-directory: _build - name: Build run: | - cmake --build . \ + cmake --build _build \ --target install \ --config ${{ matrix.build-type }} - working-directory: _build - name: Validate run: | share/ci/scripts/linux/validate_openexr_libs.sh _install diff --git a/cmake/LibraryDefine.cmake b/cmake/LibraryDefine.cmake index 3b273b07f0..39fa082ede 100644 --- a/cmake/LibraryDefine.cmake +++ b/cmake/LibraryDefine.cmake @@ -93,8 +93,8 @@ function(OPENEXR_DEFINE_LIBRARY libname) string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE) set(verlibname ${CMAKE_SHARED_LIBRARY_PREFIX}${libname}${OPENEXR_LIB_SUFFIX}${CMAKE_${uppercase_CMAKE_BUILD_TYPE}_POSTFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}) set(baselibname ${CMAKE_SHARED_LIBRARY_PREFIX}${libname}${CMAKE_${uppercase_CMAKE_BUILD_TYPE}_POSTFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}) - file(CREATE_LINK ${verlibname} ${baselibname} COPY_ON_ERROR SYMBOLIC) - install(FILES ${CMAKE_BINARY_DIR}/${baselibname} DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}) + file(CREATE_LINK ${verlibname} ${CMAKE_CURRENT_BINARY_DIR}/${baselibname} SYMBOLIC) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${baselibname} DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}) install(CODE "message(STATUS \"Creating symlink ${CMAKE_INSTALL_FULL_LIBDIR}/${baselibname} -> ${verlibname}\")") set(verlibname) set(baselibname)