Permalink
Browse files

Working CMake scripts

  • Loading branch information...
paoloambrosio committed Jan 24, 2010
1 parent 2f56cea commit 2089d6efbeb64a9afd5dc0da55e8ae5c17287005
View
@@ -0,0 +1,2 @@
+add_subdirectory(jsoncpp)
+
@@ -1,14 +1,11 @@
-cmake_minimum_required(VERSION 2.6)
project(jsoncpp)
-include_directories(include)
+set(JSON_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include CACHE INTERNAL "")
-add_library(json src/lib_json/json_reader.cpp
- src/lib_json/json_value.cpp
- src/lib_json/json_writer.cpp)
+include_directories(${JSON_INCLUDE_DIR})
-install(TARGETS json ARCHIVE DESTINATION lib)
-
-install(DIRECTORY include/json DESTINATION include)
+add_library(json src/lib_json/json_reader src/lib_json/json_value src/lib_json/json_writer)
+#install(TARGETS json ARCHIVE DESTINATION lib)
+#install(DIRECTORY ${JSON_INCLUDE_DIR}/json DESTINATION include)
View
@@ -1,17 +1,19 @@
cmake_minimum_required(VERSION 2.8)
project(cuke4cpp)
-enable_testing(true)
-include(CTest)
+#enable_testing(true)
+#include(CTest)
+set(Boost_USE_STATIC_LIBS OFF)
+set(Boost_USE_MULTITHREADED ON)
find_package(Boost COMPONENTS regex thread system REQUIRED)
-find_package(GTest REQUIRED)
-
-include_directories(${BOOST_INCLUDE_DIR} ${GTEST_INCLUDE_DIR} include)
-add_library(cuke src/cuke.cpp src/cuke_tcp_main.cpp)
+find_package(GTest REQUIRED)
-install(TARGETS cuke ARCHIVE DESTINATION lib)
-install(DIRECTORY include/cuke DESTINATION include)
+set(CUKE_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
+install(DIRECTORY ${CUKE_INCLUDE_DIR}/cuke DESTINATION include)
+add_subdirectory(3rd_party)
+add_subdirectory(src)
+add_subdirectory(examples)
View
@@ -0,0 +1,2 @@
+add_subdirectory(Calc)
+
@@ -0,0 +1,9 @@
+project(Calc)
+
+include_directories(${CUKE_INCLUDE_DIR} Calc)
+
+add_library(Calc Calc/Calculator)
+
+add_executable(CalcFeatures CalcFeatures/CalculatorSteps)
+target_link_libraries(CalcFeatures Calc cuke)
+
@@ -1,3 +1,4 @@
+#include <limits>
#include "Calculator.h"
void Calculator::push(double n) {
@@ -13,9 +14,13 @@ double Calculator::add() {
}
double Calculator::divide() {
- double result = 0;
+ double result = std::numeric_limits<double>::quiet_NaN();
for(std::list<double>::const_iterator i = values.begin(); i != values.end(); ++i) {
- result /= *i;
+ if (i == values.begin()) {
+ result = *i;
+ } else {
+ result /= *i;
+ }
}
return result;
}
@@ -1,7 +1,7 @@
// for now it works with gtest only, but it should switch library depending
// on the testing library included
#include <gtest/gtest.h>
-#include <cuke4cpp.h>
+#include <cuke/cuke.h>
#include <Calculator.h>
@@ -47,9 +47,9 @@ void CUKE_STEP_CLASS_NAME_(feature_name, step_name)::TestBody()
#define WHEN_C(context, test_name, regex) CUKE_STEP_C_(context, test_name, regex)
#define THEN_C(context, test_name, regex) CUKE_STEP_C_(context, test_name, regex)
-#define GIVEN(context, test_name, regex) GIVEN_C_(context, test_name, regex)
-#define WHEN(context, test_name, regex) WHEN_C_(context, test_name, regex)
-#define THEN(context, test_name, regex) THEN_C_(context, test_name, regex)
+#define GIVEN(context, test_name, regex) GIVEN_C(context, test_name, regex)
+#define WHEN(context, test_name, regex) WHEN_C(context, test_name, regex)
+#define THEN(context, test_name, regex) THEN_C(context, test_name, regex)
#define CUKE_PARAM(index, type, name) type name = ::cuke::fromString<type>(::cuke::StepManager::getCurrentParam(index));
View
@@ -0,0 +1,11 @@
+project(cuke)
+
+include_directories(${Boost_INCLUDE_DIR} ${GTEST_INCLUDE_DIR}
+ ${JSON_INCLUDE_DIR} ${CUKE_INCLUDE_DIR})
+
+add_library(cuke cuke cuke_tcp_main)
+
+target_link_libraries(cuke json ${GTEST_LIBRARIES} ${Boost_LIBRARIES})
+
+install(TARGETS cuke LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
+

0 comments on commit 2089d6e

Please sign in to comment.