diff --git a/IlmBase/Half/Makefile.am b/IlmBase/Half/Makefile.am index 1619b294..08f62fa4 100644 --- a/IlmBase/Half/Makefile.am +++ b/IlmBase/Half/Makefile.am @@ -12,6 +12,9 @@ lib_LTLIBRARIES = libHalf.la libHalf_la_SOURCES = half.cpp half.h halfFunction.h halfLimits.h libHalf_la_LDFLAGS = -version-info @LIBTOOL_VERSION@ -no-undefined +if LIB_SUFFIX_EXISTS +libHalf_la_LDFLAGS += -release @LIB_SUFFIX@ +endif libHalfincludedir = $(includedir)/OpenEXR diff --git a/IlmBase/IlmBase.pc.in b/IlmBase/IlmBase.pc.in index 3bf2b0d0..45fc4de7 100644 --- a/IlmBase/IlmBase.pc.in +++ b/IlmBase/IlmBase.pc.in @@ -7,7 +7,7 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ -libsuffix=@LIB_SUFFIX@ +libsuffix=@LIB_SUFFIX_DASH@ Name: IlmBase Description: Base math and exception libraries Version: @ILMBASE_VERSION@ diff --git a/IlmBase/config/CMakeLists.txt b/IlmBase/config/CMakeLists.txt index e20fa830..3f4b1581 100644 --- a/IlmBase/config/CMakeLists.txt +++ b/IlmBase/config/CMakeLists.txt @@ -5,7 +5,6 @@ include(CheckIncludeFiles) include(CheckSymbolExists) include(CheckLibraryExists) include(CheckStructHasMember) -include(CMakeDependentOption) check_include_files(ucontext.h ILMBASE_HAVE_UCONTEXT_H) if(ILMBASE_HAVE_UCONTEXT_H) @@ -73,7 +72,6 @@ install( install(TARGETS IlmBaseConfig EXPORT ${PROJECT_NAME}) add_library(IlmBase::Config ALIAS IlmBaseConfig) -cmake_dependent_option(ILMBASE_INSTALL_PKG_CONFIG "Install IlmBase.pc file" ON "WIN32" OFF) if(ILMBASE_INSTALL_PKG_CONFIG) # use a helper function to avoid variable pollution, but pretty simple function(ilmbase_pkg_config_help pcinfile) @@ -81,7 +79,7 @@ if(ILMBASE_INSTALL_PKG_CONFIG) set(exec_prefix ${CMAKE_INSTALL_BINDIR}) set(libdir ${CMAKE_INSTALL_LIBDIR}) set(includedir ${CMAKE_INSTALL_INCLUDEDIR}) - set(LIB_SUFFIX ${ILMBASE_LIB_SUFFIX}) + set(LIB_SUFFIX_DASH ${ILMBASE_LIB_SUFFIX}) if(TARGET Threads::Threads) # hrm, can't use properties as they end up as generator expressions # which don't seem to evaluate @@ -98,6 +96,8 @@ if(ILMBASE_INSTALL_PKG_CONFIG) ) endfunction() ilmbase_pkg_config_help(../IlmBase.pc.in) +else() + message(NOTICE "-- WARNING pkg-config generation disabled") endif() # The main export of the configuration - This is the diff --git a/IlmBase/config/IlmBaseSetup.cmake b/IlmBase/config/IlmBaseSetup.cmake index c48113e9..97aa30ef 100644 --- a/IlmBase/config/IlmBaseSetup.cmake +++ b/IlmBase/config/IlmBaseSetup.cmake @@ -30,6 +30,13 @@ set(ILMBASE_IEX_NAMESPACE "Iex" CACHE STRING "Public namespace alias for Iex") set(ILMBASE_ILMTHREAD_NAMESPACE "IlmThread" CACHE STRING "Public namespace alias for IlmThread") set(ILMBASE_PACKAGE_NAME "IlmBase ${ILMBASE_VERSION}" CACHE STRING "Public string / label for displaying package") +# Whether to generate and install a pkg-config file IlmBase.pc on +if(WIN32) +option(ILMBASE_INSTALL_PKG_CONFIG "Install IlmBase.pc file" OFF) +else() +option(ILMBASE_INSTALL_PKG_CONFIG "Install IlmBase.pc file" ON) +endif() + ######################## ## Build related options diff --git a/IlmBase/config/LibraryDefine.cmake b/IlmBase/config/LibraryDefine.cmake index c81a89a7..829e4b01 100644 --- a/IlmBase/config/LibraryDefine.cmake +++ b/IlmBase/config/LibraryDefine.cmake @@ -88,6 +88,14 @@ function(ILMBASE_DEFINE_LIBRARY libname) PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${ILMBASE_OUTPUT_SUBDIR} ) + if(BUILD_SHARED_LIBS AND (NOT "${ILMBASE_LIB_SUFFIX}" STREQUAL "")) + set(verlibname ${CMAKE_SHARED_LIBRARY_PREFIX}${libname}${ILMBASE_LIB_SUFFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}) + set(baselibname ${CMAKE_SHARED_LIBRARY_PREFIX}${libname}${CMAKE_SHARED_LIBRARY_SUFFIX}) + install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_INSTALL_FULL_LIBDIR} ${CMAKE_COMMAND} -E create_symlink ${verlibname} ${baselibname})") + install(CODE "message(\"-- Creating symlink in ${CMAKE_INSTALL_FULL_LIBDIR} ${baselibname} -> ${verlibname}\")") + set(verlibname) + set(baselibname) + endif() if(ILMBASE_BUILD_BOTH_STATIC_SHARED) if(use_objlib)