Skip to content

Commit a28afac

Browse files
authored
Add FIXED_LIBNAME, LIBNAMEPREFIX and LIBNAMESUFFIX
1 parent 10ea3fb commit a28afac

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ option(USE_PERL "Use the older PERL scripts for build preparation instead of uni
4040

4141
option(NO_WARMUP "Do not run a benchmark on each startup just to find the best location for the memory buffer" ON)
4242

43+
option(FIXED_LIBNAME "Use a non-versioned name for the library and no symbolic linking to variant names" OFF)
44+
45+
set(LIBNAMEPREFIX "" CACHE STRING "Add a prefix to the openblas part of the library name" )
46+
set(LIBNAMESUFFIX "" CACHE STRING "Add a suffix after the openblas part of the library name" )
47+
4348
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
4449
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)
4550
else()
@@ -96,7 +101,7 @@ message(WARNING "CMake support is experimental. It does not yet support all buil
96101
include("${PROJECT_SOURCE_DIR}/cmake/utils.cmake")
97102
include("${PROJECT_SOURCE_DIR}/cmake/system.cmake")
98103

99-
set(OpenBLAS_LIBNAME openblas${SUFFIX64_UNDERSCORE})
104+
set(OpenBLAS_LIBNAME ${LIBNAMEPREFIX}openblas${LIBNAMESUFFIX}${SUFFIX64_UNDERSCORE})
100105

101106
set(BLASDIRS interface driver/level2 driver/level3 driver/others)
102107

@@ -336,11 +341,12 @@ endif()
336341
add_subdirectory(cpp_thread_test)
337342
endif()
338343

344+
if (NOT FIXED_LIBNAME)
339345
set_target_properties(${OpenBLAS_LIBS} PROPERTIES
340346
VERSION ${OpenBLAS_MAJOR_VERSION}.${OpenBLAS_MINOR_VERSION}
341347
SOVERSION ${OpenBLAS_MAJOR_VERSION}
342348
)
343-
349+
endif()
344350
if (BUILD_SHARED_LIBS AND BUILD_RELAPACK)
345351
if (NOT MSVC)
346352
target_link_libraries(${OpenBLAS_LIBNAME}_shared "-Wl,-allow-multiple-definition")

0 commit comments

Comments
 (0)