diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a1e4b271..a4440ee1b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,6 +40,11 @@ option(USE_PERL "Use the older PERL scripts for build preparation instead of uni option(NO_WARMUP "Do not run a benchmark on each startup just to find the best location for the memory buffer" ON) +option(FIXED_LIBNAME "Use a non-versioned name for the library and no symbolic linking to variant names" OFF) + +set(LIBNAMEPREFIX "" CACHE STRING "Add a prefix to the openblas part of the library name" ) +set(LIBNAMESUFFIX "" CACHE STRING "Add a suffix after the openblas part of the library name" ) + if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") option(NO_AFFINITY "Disable support for CPU affinity masks to avoid binding processes from e.g. R or numpy/scipy to a single core" ON) else() @@ -96,7 +101,7 @@ message(WARNING "CMake support is experimental. It does not yet support all buil include("${PROJECT_SOURCE_DIR}/cmake/utils.cmake") include("${PROJECT_SOURCE_DIR}/cmake/system.cmake") -set(OpenBLAS_LIBNAME openblas${SUFFIX64_UNDERSCORE}) +set(OpenBLAS_LIBNAME ${LIBNAMEPREFIX}openblas${LIBNAMESUFFIX}${SUFFIX64_UNDERSCORE}) set(BLASDIRS interface driver/level2 driver/level3 driver/others) @@ -336,11 +341,12 @@ endif() add_subdirectory(cpp_thread_test) endif() +if (NOT FIXED_LIBNAME) set_target_properties(${OpenBLAS_LIBS} PROPERTIES VERSION ${OpenBLAS_MAJOR_VERSION}.${OpenBLAS_MINOR_VERSION} SOVERSION ${OpenBLAS_MAJOR_VERSION} ) - +endif() if (BUILD_SHARED_LIBS AND BUILD_RELAPACK) if (NOT MSVC) target_link_libraries(${OpenBLAS_LIBNAME}_shared "-Wl,-allow-multiple-definition")