未验证 提交 6df9f812 编写于 作者: sangshuduo's avatar sangshuduo 提交者: GitHub

chore: make odbc cmake file compatible with lower version cmake (#13086)

* chore: make odbc cmake file compatible with lower version cmake

[TD-16059]

* chore: check cmake version
上级 c558cd02
......@@ -58,7 +58,7 @@ macro(check_odbc_requirement)
check_symbol_exists(SQLExecute "sql.h" HAVE_ODBC_DEV)
IF (NOT HAVE_ODBC_DEV)
message(WARNING "odbc requirement not satisfied, check detail in ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log")
message(WARNING "odbc requirement not satisfied, please install unixodbc-dev. Check detail in ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log")
return ()
ENDIF ()
......
......@@ -4,7 +4,11 @@ ADD_EXECUTABLE(tcodbc main.c ../../src/todbc_log.c)
IF (TD_LINUX OR TD_DARWIN)
target_include_directories(tcodbc PRIVATE ${ODBC_INCLUDE_DIRECTORY})
target_link_directories(tcodbc PUBLIC ${ODBC_LIBRARY_DIRECTORY})
IF (CMAKE_VERSION VERSION_LESS 3.13)
link_directories(AFTER ${ODBC_LIBRARY_DIRECTORY})
ELSE ()
target_link_directories(tcodbc PUBLIC ${ODBC_LIBRARY_DIRECTORY})
ENDIF ()
TARGET_LINK_LIBRARIES(tcodbc taos odbc)
ENDIF ()
......
......@@ -19,7 +19,11 @@ IF (TD_LINUX_64)
SET_TARGET_PROPERTIES(todbc PROPERTIES VERSION ${TD_VER_NUMBER} SOVERSION 1)
TARGET_LINK_LIBRARIES(todbc todbc_base taos odbcinst)
target_include_directories(todbc PRIVATE . ${ODBC_INCLUDE_DIRECTORY})
target_link_directories(todbc PUBLIC ${ODBC_LIBRARY_DIRECTORY})
IF (CMAKE_VERSION VERSION_LESS 3.13)
link_directories(AFTER ${ODBC_LIBRARY_DIRECTORY})
ELSE ()
target_link_directories(todbc PUBLIC ${ODBC_LIBRARY_DIRECTORY})
ENDIF ()
install(CODE "execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/install.sh ${CMAKE_BINARY_DIR})")
ENDIF ()
......
......@@ -5,7 +5,11 @@ ADD_EXECUTABLE(tconv tconv.c)
IF (TD_LINUX OR TD_DARWIN)
target_include_directories(todbcinst PRIVATE . ${ODBC_INCLUDE_DIRECTORY} ${ODBCINST_INCLUDE_DIRECTORY})
target_link_directories(todbcinst PUBLIC ${ODBC_LIBRARY_DIRECTORY} ${ODBCINST_LIBRARY_DIRECTORY})
IF (CMAKE_VERSION VERSION_LESS 3.13)
link_directories(AFTER ${ODBC_LIBRARY_DIRECTORY})
ELSE ()
target_link_directories(todbcinst PUBLIC ${ODBC_LIBRARY_DIRECTORY} ${ODBCINST_LIBRARY_DIRECTORY})
ENDIF ()
TARGET_LINK_LIBRARIES(todbcinst odbc odbcinst)
ENDIF ()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册