I am using gtest for my library. I have two CMakeLists.txt, one for the main project and another one for the tests. In the main CMakelists.txt, I set
add_library(myLib::myLib ALIAS ${TARGETS_LIB_NAME})
Then in the gtest CMakeLists.txt, I link it as
target_link_libraries(test1 myLib::myLib)
But it keeps linking to installed version of myLib, not the one that is just built. Whenever I modify the header file, I have to delete the installed library in order to build the tests. What is a proper way to do this?