Cmake Pybind11 Cannot Create Target Because Another Target With The Same Name Already Exists, How To Bypass?
I have code which successfully runs. Its CmakeLists.txt is: cmake_minimum_required(VERSION 3.15) project(rotapro3) set(CMAKE_CXX_STANDARD 14) add_executable(rotapro3 main.cpp): I w
Solution 1:
In CMake, you cannot have two targets with the same name. Because the pybind11_add_module()
is similar to add_library()
, you should use this command to create a library target. You can name this library target rotapro3
. Then, you can create your executable target, named something else (like rotapro3_exe
):
cmake_minimum_required(VERSION 3.15)
project(rotapro3)
set(CMAKE_CXX_STANDARD 14)
add_subdirectory(pybind)
# Create the library rotapro3 target here.
pybind11_add_module(rotapro3 example.cpp)
# Create your executable target (with a different name).
add_executable(rotapro3_exe main.cpp)
Post a Comment for "Cmake Pybind11 Cannot Create Target Because Another Target With The Same Name Already Exists, How To Bypass?"