CMake错误:'目标不是由此项目构建的。克里昂科特林

时间:2018-02-21 18:11:06

标签: opencv cmake kotlin opencv3.0

我试图在CMakeFile.txt中加载OpenCV库,但它始终以此错误结束:

CMake Error at CMakeLists.txt:21 (target_link_libraries):
  Cannot specify link libraries for target "HelloWorld" which is not built by
  this project.

我在互联网上搜索过但没有解决方案。

   cmake_minimum_required(VERSION 3.8)

   set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/KotlinCMakeModule)

   project(untitled1 Kotlin)

   find_package(OpenCV REQUIRED)


   IF (OpenCV_FOUND)
      include_directories(/usr/local/Cellar/opencv/3.4.0_1/include)
      link_libraries(/usr/local/Cellar/opencv/3.4.0_1/lib)
   ENDIF(OpenCV_FOUND)


  konanc_executable(
        NAME HelloWorld
       SOURCES hello.kt
  )

  target_link_libraries(HelloWorld
         /usr/local/Cellar/opencv/3.4.0_1/lib
         )
有人可以帮帮我吗?我认为它不起作用,因为使用konanc_executable代替add_executable,但我需要使用Kotlin,因此我无法使用add_executable命令。

0 个答案:

没有答案