diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f258a5f..830c7037 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,19 +1,7 @@ cmake_minimum_required(VERSION 2.8.4) project(ArduinoJson) -file(GLOB_RECURSE SRCS_FILES srcs/*.cpp) -file(GLOB TESTS_FILES tests/*.cpp) +enable_testing() -add_library(ArduinoJson ${SRCS_FILES}) - -include_directories( - srcs - third-party/gtest-1.7.0 - third-party/gtest-1.7.0/include) - -add_executable(ArduinoJsonTests - ${TESTS_FILES} - third-party/gtest-1.7.0/src/gtest-all.cc - third-party/gtest-1.7.0/src/gtest_main.cc) - -target_link_libraries(ArduinoJsonTests ArduinoJson) \ No newline at end of file +add_subdirectory(srcs) +add_subdirectory(tests) \ No newline at end of file diff --git a/srcs/CMakeLists.txt b/srcs/CMakeLists.txt new file mode 100644 index 00000000..7c7aaab5 --- /dev/null +++ b/srcs/CMakeLists.txt @@ -0,0 +1,3 @@ +file(GLOB_RECURSE SRCS_FILES *.cpp) + +add_library(ArduinoJson ${SRCS_FILES}) \ No newline at end of file diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 00000000..d1a8c667 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,17 @@ +set(GTEST_DIR ../third-party/gtest-1.7.0) + +file(GLOB TESTS_FILES *.cpp) + +include_directories( + ../srcs + ${GTEST_DIR} + ${GTEST_DIR}/include) + +add_executable(ArduinoJsonTests + ${TESTS_FILES} + ${GTEST_DIR}/src/gtest-all.cc + ${GTEST_DIR}/src/gtest_main.cc) + +target_link_libraries(ArduinoJsonTests ArduinoJson) + +add_test(ArduinoJsonTests ArduinoJsonTests) \ No newline at end of file