66# the terms of the Apache License 2.0 which accompanies this distribution. #
77# ============================================================================ #
88
9+ set (LIBRARY_NAME cudaq-qec)
10+
911add_compile_options (-Wno-attributes)
1012
1113# FIXME?: This must be a shared library. Trying to build a static one will fail.
12- add_library (cudaq-qec SHARED
14+ add_library (${LIBRARY_NAME} SHARED
1315 code.cpp
1416 stabilizer_utils.cpp
1517 decoder.cpp
@@ -20,22 +22,22 @@ add_library(cudaq-qec SHARED
2022add_subdirectory (codes)
2123add_subdirectory (device)
2224
23- if (CUDAQX_QEC_USE_DOUBLE )
24- target_compile_definitions (cudaq-qec PUBLIC -DCUDAQX_QEC_FLOAT_TYPE=double )
25+ if (CUDAQX_QEC_USE_FLOAT )
26+ target_compile_definitions (${LIBRARY_NAME} PUBLIC -DCUDAQX_QEC_FLOAT_TYPE=float )
2527endif ()
2628
27- target_include_directories (cudaq-qec
29+ target_include_directories (${LIBRARY_NAME}
2830 PUBLIC
2931 $<BUILD_INTERFACE:${CUDAQX_QEC_INCLUDE_DIR} >
3032 $<INSTALL_INTERFACE:${CUDAQ_INCLUDE_DIR} >
3133 $<INSTALL_INTERFACE:include >
3234)
3335
34- target_link_options (cudaq-qec PUBLIC
36+ target_link_options (${LIBRARY_NAME} PUBLIC
3537 $<$<CXX_COMPILER_ID:GNU>:-Wl,--no -as-needed>
3638)
3739
38- target_link_libraries (cudaq-qec
40+ target_link_libraries (${LIBRARY_NAME}
3941 PUBLIC
4042 cudaqx-core
4143 cudaq::cudaq
@@ -44,33 +46,33 @@ target_link_libraries(cudaq-qec
4446 cudaq::cudaq-common
4547)
4648
47- set_target_properties (cudaq-qec PROPERTIES
49+ set_target_properties (${LIBRARY_NAME} PROPERTIES
4850 LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} /lib)
4951
5052# RPATH configuration
5153# ==============================================================================
5254
5355if (NOT SKBUILD)
54- set_target_properties (cudaq-qec PROPERTIES
56+ set_target_properties (${LIBRARY_NAME} PROPERTIES
5557 BUILD_RPATH "$ORIGIN"
5658 INSTALL_RPATH "$ORIGIN:$ORIGIN/../lib"
5759 )
5860
5961 # Let CMake automatically add paths of linked libraries to the RPATH:
60- set_target_properties (cudaq-qec PROPERTIES
62+ set_target_properties (${LIBRARY_NAME} PROPERTIES
6163 INSTALL_RPATH_USE_LINK_PATH TRUE )
6264else ()
6365 # CUDA-Q install its libraries in site-packages/lib (or dist-packages/lib)
6466 # Thus, we need the $ORIGIN/../lib
65- set_target_properties (cudaq-qec PROPERTIES
67+ set_target_properties (${LIBRARY_NAME} PROPERTIES
6668 INSTALL_RPATH "$ORIGIN/../../lib"
6769 )
6870endif ()
6971
7072# Install
7173# ==============================================================================
7274
73- install (TARGETS cudaq-qec
75+ install (TARGETS ${LIBRARY_NAME}
7476 COMPONENT qec-lib
7577 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
7678)
0 commit comments