I am asking this to verify that my code is implemented correctly. If it is, then that more than likely means that my library linkage is incorrect at some point, which narrows down the problem. I'm getting the following errors upon trying to build my test using make t1
:
make[3]: *** No rule to make target `/home/esias/VL3/modular2/vlMain/test', needed by `vlMain/CMakeFiles/t1'. Stop.
make[2]: *** [vlMain/CMakeFiles/t1.dir/all] Error 2
make[1]: *** [vlMain/CMakeFiles/t1.dir/rule] Error 2
Suppose I would like to build executable "exec1" and test it. Ideally, this is done by tagging the executable to a target and running make <target>
- please correct me if I'm wrong.
As far as I am aware, this is done by using the --build-and-test argument on add_test. This is the code I am using:
ADD_TEST(test1 exec1
--build-two-config
--build-and-test
"${CMAKE_SOURCE_DIR}/vlMain/vlMPIMain.cpp" #source to create from?
"${CMAKE_BINARY_DIR}/Tests/exec1" #output folder?
)
add_custom_target(t1 COMMAND ${CMAKE_CTEST_COMMAND} DEPENDS test1)
TARGET_LINK_LIBRARIES(t1
${GLEW_LIBRARY}
vlapp
vlrender
vldm
)
I would like to build an executable called "exec1" using ${CMAKE_SOURCE_DIR}/vlMain/vlMPIMain.cpp
as source code, and put it into ${CMAKE_BINARY_DIR}/Tests/exec1
Then I would like to link a couple of libraries to it.
Is my implementation correct? Can it be improved?
Thanks.