Don't use special compiler flags.
Add upstream patch to make dependencies explicit; needed for ninja builds.
--- src/CMakeLists.txt.orig	2014-03-15 15:11:32 UTC
+++ src/CMakeLists.txt
@@ -3,7 +3,6 @@ PROTOBUF_GENERATE_CPP(CPPS HS fileformat
 if(MSVC)
     set(CMAKE_CXX_FLAGS "/O3")
 else()
-    set(CMAKE_CXX_FLAGS "-O3")
 endif()
 
 add_library(osmpbf STATIC ${CPPS})
@@ -10,8 +10,13 @@ add_library(osmpbf STATIC ${CPPS})
 
 set_target_properties(osmpbf PROPERTIES LINKER_LANGUAGE CXX LANGUAGE CXX)
 
-ADD_CUSTOM_COMMAND(TARGET osmpbf POST_BUILD  COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/src/fileformat.pb.h ${CMAKE_SOURCE_DIR}/include/osmpbf)
-ADD_CUSTOM_COMMAND(TARGET osmpbf POST_BUILD  COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/src/osmformat.pb.h ${CMAKE_SOURCE_DIR}/include/osmpbf)
+ADD_CUSTOM_COMMAND(TARGET osmpbf POST_BUILD
+    COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/src/fileformat.pb.h ${CMAKE_SOURCE_DIR}/include/osmpbf
+    COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/src/osmformat.pb.h ${CMAKE_SOURCE_DIR}/include/osmpbf
+    BYPRODUCTS
+        ${CMAKE_SOURCE_DIR}/include/osmpbf/fileformat.pb.h
+        ${CMAKE_SOURCE_DIR}/include/osmpbf/osmformat.pb.h
+)
 
 SET(INCLUDE_INSTALL "include/osmpbf")
 SET(files ${CMAKE_SOURCE_DIR}/include/osmpbf/osmpbf.h ${CMAKE_BINARY_DIR}/src/osmformat.pb.h ${CMAKE_BINARY_DIR}/src/fileformat.pb.h)
