cmake: fix double symbol linking in TV opt module
MODIFY
CMakeLists.txt
CMakeLists.txt
@@ -110,7 +110,7 @@ if (BUILD_LLVM_UTILS OR BUILD_TV)
add_library(llvm_util STATIC ${LLVM_UTIL_SRCS})
set(ALIVE_LIBS_LLVM llvm_util ${ALIVE_LIBS})
- add_executable(alive-tv
+ add_llvm_executable(alive-tv
"tools/alive-tv.cpp"
)
@@ -118,6 +118,16 @@ else()
set(LLVM_UTIL_SRCS "")
endif()
+if (BUILD_TV)
+ if (CYGWIN)
+ message(FATAL_ERROR "LLVM plugins not supported on cygwin")
+ endif()
+ message(STATUS "Compiling translation validation plugin")
+ add_subdirectory(tv)
+else()
+ message(STATUS "Skiping translation validation plugin")
+endif()
+
add_executable(alive
"tools/alive.cpp"
"${CMAKE_BINARY_DIR}/tools/alive_lexer.cpp"
@@ -130,7 +140,7 @@ add_library(alive2 SHARED ${IR_SRCS} ${SMT_SRCS} ${TOOLS_SRCS} ${UTIL_SRCS} ${LL
if (BUILD_LLVM_UTILS OR BUILD_TV)
llvm_map_components_to_libnames(llvm_libs support core irreader)
target_link_libraries(alive2 PRIVATE ${llvm_libs})
- target_link_libraries(alive-tv PRIVATE llvm_util ${ALIVE_LIBS} ${llvm_libs})
+ target_link_libraries(alive-tv PRIVATE ${ALIVE_LIBS_LLVM} ${llvm_libs})
endif()
if (CYGWIN)
@@ -144,16 +154,6 @@ else()
target_link_libraries(alive2 PRIVATE ${Z3_LIBRARIES})
endif()
-if (BUILD_TV)
- if (CYGWIN)
- message(FATAL_ERROR "LLVM plugins not supported on cygwin")
- endif()
- message(STATUS "Compiling translation validation plugin")
- add_subdirectory(tv)
-else()
- message(STATUS "Skiping translation validation plugin")
-endif()
-
add_custom_target("check"
COMMAND "python"
"${PROJECT_SOURCE_DIR}/tests/lit/lit.py"

cmake: fix double symbol linking in TV opt module