@@ -41,6 +41,17 @@ endif()
41
41
option (BUILD_SHARED_LIBS "Build shared library. Turned ON by default." ON )
42
42
message (STATUS "Shared library is turned ${BUILD_SHARED_LIBS} . Set BUILD_SHARED_LIBS to modify." )
43
43
44
+ # Library naming
45
+ set (LIB_NAME QuEST
46
+ CACHE
47
+ STRING
48
+ "Change library name. LIB_NAME is QuEST by default."
49
+ )
50
+ message (STATUS "Library will be named lib${LIB_NAME} . Set LIB_NAME to modify." )
51
+
52
+ option (VERBOSE_LIB_NAME "Modify library name based on compilation configuration. Turned OFF by default." OFF )
53
+ message (STATUS "Verbose library naming is turned ${VERBOSE_LIB_NAME} . Set VERBOSE_LIB_NAME to modify." )
54
+
44
55
# Precision
45
56
set (FLOAT_PRECISION 2
46
57
CACHE
@@ -54,6 +65,10 @@ set_property(CACHE FLOAT_PRECISION PROPERTY STRINGS
54
65
)
55
66
message (STATUS "Precision set to ${FLOAT_PRECISION} . Set FLOAT_PRECISION to modify." )
56
67
68
+ if (VERBOSE_LIB_NAME)
69
+ string (CONCAT LIB_NAME ${LIB_NAME} "-fp${FLOAT_PRECISION} " )
70
+ endif ()
71
+
57
72
# Testing
58
73
option (
59
74
ENABLE_TESTING
@@ -136,6 +151,9 @@ if (ENABLE_MULTITHREADING)
136
151
OpenMP::OpenMP_CXX
137
152
OpenMP::OpenMP_C
138
153
)
154
+ if (VERBOSE_LIB_NAME)
155
+ string (CONCAT LIB_NAME ${LIB_NAME} "+mt" )
156
+ endif ()
139
157
else ()
140
158
target_compile_definitions (QuEST PUBLIC COMPILE_OPENMP=0)
141
159
endif ()
@@ -149,13 +167,19 @@ if (ENABLE_DISTRIBUTION)
149
167
PUBLIC
150
168
MPI::MPI_CXX
151
169
)
170
+ if (VERBOSE_LIB_NAME)
171
+ string (CONCAT LIB_NAME ${LIB_NAME} "+mpi" )
172
+ endif ()
152
173
else ()
153
174
target_compile_definitions (QuEST PUBLIC COMPILE_MPI=0)
154
175
endif ()
155
176
156
177
if (ENABLE_GPU_ACCELERATION)
157
178
enable_language (CUDA)
158
179
target_compile_definitions (QuEST PUBLIC COMPILE_CUDA=1)
180
+ if (VERBOSE_LIB_NAME)
181
+ string (CONCAT LIB_NAME ${LIB_NAME} "+cuda" )
182
+ endif ()
159
183
else ()
160
184
target_compile_definitions (QuEST PUBLIC COMPILE_CUDA=0)
161
185
endif ()
@@ -170,6 +194,10 @@ if (NOT MSVC)
170
194
target_link_libraries (QuEST PUBLIC ${MATH_LIBRARY} )
171
195
endif ()
172
196
197
+ # Set output name
198
+ set_target_properties (QuEST PROPERTIES OUTPUT_NAME ${LIB_NAME} )
199
+
200
+ # Add source files
173
201
add_subdirectory (quest)
174
202
175
203
## Examples
0 commit comments