Skip to content

Commit c6002a4

Browse files
committed
Add operator= and fix some bugs
1 parent 702756c commit c6002a4

File tree

5 files changed

+7
-12
lines changed

5 files changed

+7
-12
lines changed

CMakeLists.txt

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
21
project(prometheus-cpp-lite)
32
cmake_minimum_required(VERSION 3.2)
43

54
option(PROMETHEUS_BUILD_EXAMPLES "Build with examples" OFF)
65

7-
if(WIN32)
6+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
87

9-
# This properties specifies the directories into which targets files should be built
10-
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) # Set old executable location variable
11-
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin) # Set new executable location variable. Then it can be read from RUNTIME_OUTPUT_DIRECTORY variable.
8+
if(WIN32)
129

1310
# it prevent create Debug/ and Release folders in Visual Studio
1411
foreach( OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES} )
@@ -22,10 +19,6 @@ else() # not WIN32
2219

2320
set (INSTALL_PATH_BIN "bin/")
2421

25-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Werror")
26-
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -ggdb3")
27-
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2")
28-
2922
endif()
3023

3124
add_subdirectory("./core")

core/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
21
project(prometheus-cpp-lite-core)
32
cmake_minimum_required(VERSION 3.2)
43

54
file(GLOB_RECURSE PROMETHEUS_CPP_LITE_HEADERS *.h)
65

6+
# it is header only target
7+
78
add_library (${PROJECT_NAME} INTERFACE)
89
target_sources (${PROJECT_NAME} INTERFACE ${PROMETHEUS_CPP_LITE_HEADERS})
910
target_include_directories(${PROJECT_NAME} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include)
@@ -12,6 +13,7 @@ target_link_libraries (${PROJECT_NAME} INTERFACE http-client-lite)
1213

1314
set (${PROJECT_NAME}_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/include PARENT_SCOPE)
1415

16+
# it need for save_to_file_t
1517
if(NOT WIN32)
1618
find_package(Threads)
1719
target_link_libraries(${PROJECT_NAME} INTERFACE ${CMAKE_THREAD_LIBS_INIT})

examples/simpleapi_example.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ int main() {
2121
if (random_value & 8) metric4++;
2222
}
2323

24-
return 0;
24+
//return 0;
2525

2626
}

simpleapi/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
project(prometheus-cpp-simpleapi)
32
cmake_minimum_required(VERSION 3.2)
43

simpleapi/include/prometheus/simpleapi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ namespace prometheus {
109109
void operator-- () { metric_->Decrement(); }
110110
void operator-- (int) { metric_->Decrement(); }
111111
void operator-= (typename Metric::Value val) { metric_->Decrement(val); }
112+
void operator= (typename Metric::Value val) { metric_->Set(val); }
112113

113114
int64_t value() const { return metric_->Get(); }
114115

0 commit comments

Comments
 (0)