diff --git a/ports/openexr/fix-static-linking.patch b/ports/openexr/fix-static-linking.patch new file mode 100644 index 00000000000..af2f067f127 --- /dev/null +++ b/ports/openexr/fix-static-linking.patch @@ -0,0 +1,14 @@ +diff --git a/IlmImf/CMakeLists.txt b/IlmImf/CMakeLists.txt +index 18d90edc..21bbaa27 100644 +--- a/IlmImf/CMakeLists.txt ++++ b/IlmImf/CMakeLists.txt +@@ -25,8 +25,8 @@ ADD_EXECUTABLE ( dwaLookups + + TARGET_LINK_LIBRARIES ( dwaLookups + Half +- Iex${ILMBASE_LIBSUFFIX} + IlmThread${ILMBASE_LIBSUFFIX} ++ Iex${ILMBASE_LIBSUFFIX} + ${PTHREAD_LIB} + ) + diff --git a/ports/openexr/portfile.cmake b/ports/openexr/portfile.cmake index 7e3b6603fc4..b02a487a9f3 100644 --- a/ports/openexr/portfile.cmake +++ b/ports/openexr/portfile.cmake @@ -13,6 +13,7 @@ vcpkg_apply_patches(SOURCE_PATH ${SOURCE_PATH} PATCHES "${CMAKE_CURRENT_LIST_DIR}/add-missing-export.patch" "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt.patch" + "${CMAKE_CURRENT_LIST_DIR}/fix-static-linking.patch" ) # Ensure helper executables can run during build @@ -20,7 +21,7 @@ set(ENV{PATH} "$ENV{PATH};${CURRENT_INSTALLED_DIR}/bin") # In debug build buildsystem cannot locate IlmBase headers set(VCPKG_C_FLAGS_DEBUG "${VCPKG_C_FLAGS_DEBUG}") -set(VCPKG_CXX_FLAGS_DEBUG "${VCPKG_CXX_FLAGS_DEBUG} -I\"${CURRENT_INSTALLED_DIR}/include/OpenExr\"") +set(VCPKG_CXX_FLAGS_DEBUG "${VCPKG_CXX_FLAGS_DEBUG} -I\"${CURRENT_INSTALLED_DIR}/include/OpenEXR\"") vcpkg_configure_cmake(SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA diff --git a/scripts/toolchains/linux.cmake b/scripts/toolchains/linux.cmake index ea4f15d60b5..1ad180b4bdb 100644 --- a/scripts/toolchains/linux.cmake +++ b/scripts/toolchains/linux.cmake @@ -2,3 +2,17 @@ if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux") set(CMAKE_CROSSCOMPILING OFF CACHE BOOL "") endif() set(CMAKE_SYSTEM_NAME Linux CACHE STRING "") + +get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE ) +if(NOT _CMAKE_IN_TRY_COMPILE) + set(CMAKE_CXX_FLAGS " ${VCPKG_CXX_FLAGS}" CACHE STRING "") + set(CMAKE_C_FLAGS " ${VCPKG_C_FLAGS}" CACHE STRING "") + + set(CMAKE_CXX_FLAGS_DEBUG "${VCPKG_CXX_FLAGS_DEBUG}" CACHE STRING "") + set(CMAKE_C_FLAGS_DEBUG "${VCPKG_C_FLAGS_DEBUG}" CACHE STRING "") + set(CMAKE_CXX_FLAGS_RELEASE "${VCPKG_CXX_FLAGS_RELEASE}" CACHE STRING "") + set(CMAKE_C_FLAGS_RELEASE "${VCPKG_C_FLAGS_RELEASE}" CACHE STRING "") + + set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${VCPKG_LINKER_FLAGS}" CACHE STRING "") + set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${VCPKG_LINKER_FLAGS}" CACHE STRING "") +endif()