How I can make friends pybind11 with another libs? I using CMake and MinGW
cmake_minimum_required(VERSION 3.24)
project(cmake_example)
add_subdirectory(pybind11)
pybind11_add_module(cmake_example src/main.cpp)
target_compile_definitions(cmake_example PRIVATE VERSION_INFO=${EXAMPLE_VERSION_INFO})
This is default settings for getting start. I have another lib, which I build before. My attempt looks like this:
cmake_minimum_required(VERSION 3.24)
project(cmake_example)
add_subdirectory(pybind11)
add_subdirectory(anotherlib_dir)
pybind11_add_module(cmake_example src/main.cpp)
target_link_libraries(anotherlib)
target_compile_definitions(cmake_example PRIVATE VERSION_INFO=${EXAMPLE_VERSION_INFO})
Where anotherlib_dir
looks like this:
- lib
- src
- CMakeLists.txt
This lib works correctly (I tested it in clear project)
But this solution do not working. On building I have problems with undefined reference
Someone tried to make friends libraries? I don't know what else to try
I am sure that there are no problems with my library, since CMake defines it:
The existing target is a static library created [cmake] in source directory ".../cmake_example".
In clear project I link libs look like
add_subdirectory(anotherlib_dir)
target_link_libraries(ProjectName anotherlib)
In pybind11
ProjectName not specified. As I understand, pybind11 has custom superctructure, which can define project.