1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| message("<< Support exes & GTest: ") set(googleTestDir ./googletest)
add_subdirectory(${googleTestDir})
include_directories(${googleTestDir}/googletest/include)
include_directories(${googleTestDir}/googlemock/include)
file(GLOB_RECURSE files *.cpp)
foreach (file ${files}) file(RELATIVE_PATH path "${CMAKE_BINARY_DIR}" "${file}") string(REGEX REPLACE ".+/(.+)\\..*" "\\1" exe ${path}) add_executable(${exe} ${path}) target_link_libraries(${exe} gtest gtest_main) target_link_libraries(${exe} gmock gmock_main) message(\ \ \ \ --\ src/${exe}.cpp\ will\ be\ compiled\ to\ bin/${exe}) endforeach ()
|