Fix install and unnecessary string copy - Fix the following issue when running "make install" https://github.com/ceres-solver/ceres-solver/issues/527 - Fix error that CeresCodeGeneration.cmake was not found after instalation. Issue: https://github.com/ceres-solver/ceres-solver/issues/561 - Removes the unnecessary string copy during code generation Change-Id: I01963d01da6a9c4557aad6f89831647c1a149e38
diff --git a/CMakeLists.txt b/CMakeLists.txt index 9bd1e90..236bb50 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt
@@ -772,7 +772,7 @@ DESTINATION ${RELATIVE_CMAKECONFIG_INSTALL_DIR}) # Install codegen cmake scripts -install(FILES "${Ceres_SOURCE_DIR}/cmake/codegen_include.h.in" +install(FILES "${Ceres_SOURCE_DIR}/cmake/codegen_include.inc.in" "${Ceres_SOURCE_DIR}/cmake/generate_code_for_functor.cc.in" "${Ceres_SOURCE_DIR}/cmake/CeresCodeGeneration.cmake" DESTINATION ${RELATIVE_CMAKECONFIG_INSTALL_DIR})
diff --git a/cmake/CeresConfig.cmake.in b/cmake/CeresConfig.cmake.in index fd84dd2..cb0fd7b 100644 --- a/cmake/CeresConfig.cmake.in +++ b/cmake/CeresConfig.cmake.in
@@ -168,7 +168,7 @@ # Import code generation functions s/t they are available for use in client code # if find_package(Ceres) is successful. -include(CeresCodeGeneration.cmake) +include(CeresCodeGeneration) # Eigen. # Flag set during configuration and build of Ceres.
diff --git a/cmake/generate_code_for_functor.cc.in b/cmake/generate_code_for_functor.cc.in index 2ae2640..e259f71 100644 --- a/cmake/generate_code_for_functor.cc.in +++ b/cmake/generate_code_for_functor.cc.in
@@ -20,7 +20,7 @@ std::cerr << "Could not open file " << output_file << std::endl; return EXIT_FAILURE; } - for (auto line : lines) { + for (const auto& line : lines) { stream << line << std::endl; } return EXIT_SUCCESS;