Here is my CMakeLists.txt:
ExternalProject_Add(
subhook
GIT_REPOSITORY https://github.com/Zeex/subhook.git
GIT_TAG v0.8.2
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/subhook-src"
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/subhook-build"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LOCATION} -DSUBHOOK_STATIC=ON -DSUBHOOK_TESTS=OFF SUBHOOK_FORCE_32BIT=ON)
include_directories(${EXTERNAL_INSTALL_LOCATION}/include)
link_directories(${EXTERNAL_INSTALL_LOCATION}/lib)
add_executable(t_test ${_testfile})
add_dependencies(t_test subhook)
I will get this error
t_test.obj : error LNK2019: unresolved external symbol __imp__subhook_new referenced in function ...
I cannot directory add
target_link_libraries(t_test subhook)
which may show this error:
CMake Error at test/base/CMakeLists.txt:24 (target_link_libraries):
Target "subhook" of type UTILITY may not be linked into another target.
One may link only to INTERFACE, OBJECT, STATIC or SHARED libraries, or to
executables with the ENABLE_EXPORTS property set.
I’m on windows.
How can I fix this one?
Thanks everyone for reading.