Hi - I've got an issue that I don't understand - hoping to get some insight into what I am doing wrong. I have a chai script with two functions - both exactly the same, I can call the first one fine, but the second one silently fails. I run .eval on the script first, then have a function containing this line "chaiInstance.eval<std::function<void ()>>(functionName);" - it only seems to work on the one function call ie: chai_runFunction("scriptFunc"); - and does nothing calling "chai_runFunction("printFromScript");". this is the script: def scriptFunc()
{
testGlobalVar = 555;
}
def printFromScript()
{
testGlobalVar = 9999;
}
I do it in my project like this:
Add an external_project
https://github.com/StanEpp/ChaiDwarfs/blob/master/deps/CMakeLists.txt#L221
Just add it as a dependency to the project
https://github.com/StanEpp/ChaiDwarfs/blob/master/CMakeLists.txt#L115
As @Ybalrid already said there's nothing to link against. You just include the header files and are good to go.
My problem is, that I have something like:
ace/
lib/
chaiscript/
spdlog/
libA/ --> uses chaiscript and spdlog
libB/ --> uses chaiscript and spdlog
src/
main.cpp --> uses libA and libB
CMakeLists.txt
How can I do this using cmake? In the case of other header-only libraries like spdlog, I simply write the following project file:
cmake_minimum_required(VERSION 3.1...3.11)
project(ace VERSION 5.0.0)
add_subdirectory(lib/spdlog/)
target_link_libraries(ace PRIVATE libA)
target_link_libraries(ace PRIVATE libB)
And inside the libraries I have:
cmake_minimum_required(VERSION 3.1...3.11)
project(libA VERSION 1.0.0)
target_link_libraries(libA PRIVATE spdlog)