Commit 48014a3c299b1ef4fd470f7fce2a77f4b9185b97
Committed by
GitHub
Merge pull request #14 from ZoetisDenmark/zoetis
Build updates
Showing
2 changed files
with
33 additions
and
30 deletions
CMakeLists.txt
| ... | ... | @@ -17,36 +17,39 @@ endif () |
| 17 | 17 | #========================================= gtest INSTALL =========================================# |
| 18 | 18 | #=================================================================================================# |
| 19 | 19 | |
| 20 | -# Download and unpack googletest at configure time | |
| 21 | -configure_file(CMakeLists.txt.in googletest-download/CMakeLists.txt) | |
| 22 | -execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . | |
| 23 | - RESULT_VARIABLE result | |
| 24 | - WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download ) | |
| 25 | -if(result) | |
| 26 | - message(FATAL_ERROR "CMake step for googletest failed: ${result}") | |
| 27 | -endif() | |
| 28 | -execute_process(COMMAND ${CMAKE_COMMAND} --build . | |
| 29 | - RESULT_VARIABLE result | |
| 30 | - WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download ) | |
| 31 | -if(result) | |
| 32 | - message(FATAL_ERROR "Build step for googletest failed: ${result}") | |
| 33 | -endif() | |
| 20 | +if (BUILD_TESTS) | |
| 21 | + # Download and unpack googletest at configure time | |
| 22 | + configure_file(CMakeLists.txt.in googletest-download/CMakeLists.txt) | |
| 23 | + execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . | |
| 24 | + RESULT_VARIABLE result | |
| 25 | + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download ) | |
| 26 | + if(result) | |
| 27 | + message(FATAL_ERROR "CMake step for googletest failed: ${result}") | |
| 28 | + endif() | |
| 29 | + execute_process(COMMAND ${CMAKE_COMMAND} --build . | |
| 30 | + RESULT_VARIABLE result | |
| 31 | + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download ) | |
| 32 | + if(result) | |
| 33 | + message(FATAL_ERROR "Build step for googletest failed: ${result}") | |
| 34 | + endif() | |
| 35 | + | |
| 36 | + # Prevent overriding the parent project's compiler/linker | |
| 37 | + # settings on Windows | |
| 38 | + set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) | |
| 39 | + | |
| 40 | + # Add googletest directly to our build. This defines | |
| 41 | + # the gtest and gtest_main targets. | |
| 42 | + add_subdirectory(${CMAKE_BINARY_DIR}/googletest-src | |
| 43 | + ${CMAKE_BINARY_DIR}/googletest-build | |
| 44 | + EXCLUDE_FROM_ALL) | |
| 45 | + | |
| 46 | + # The gtest/gtest_main targets carry header search path | |
| 47 | + # dependencies automatically when using CMake 2.8.11 or | |
| 48 | + # later. Otherwise we have to add them here ourselves. | |
| 49 | + if (CMAKE_VERSION VERSION_LESS 2.8.11) | |
| 50 | + include_directories("${gtest_SOURCE_DIR}/include") | |
| 51 | + endif() | |
| 34 | 52 | |
| 35 | -# Prevent overriding the parent project's compiler/linker | |
| 36 | -# settings on Windows | |
| 37 | -set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) | |
| 38 | - | |
| 39 | -# Add googletest directly to our build. This defines | |
| 40 | -# the gtest and gtest_main targets. | |
| 41 | -add_subdirectory(${CMAKE_BINARY_DIR}/googletest-src | |
| 42 | - ${CMAKE_BINARY_DIR}/googletest-build | |
| 43 | - EXCLUDE_FROM_ALL) | |
| 44 | - | |
| 45 | -# The gtest/gtest_main targets carry header search path | |
| 46 | -# dependencies automatically when using CMake 2.8.11 or | |
| 47 | -# later. Otherwise we have to add them here ourselves. | |
| 48 | -if (CMAKE_VERSION VERSION_LESS 2.8.11) | |
| 49 | - include_directories("${gtest_SOURCE_DIR}/include") | |
| 50 | 53 | endif() |
| 51 | 54 | |
| 52 | 55 | #=================================================================================================# | ... | ... |
src/CMakeLists.txt
| ... | ... | @@ -16,4 +16,4 @@ install(TARGETS CppLinuxSerial DESTINATION lib) |
| 16 | 16 | |
| 17 | 17 | # On Linux, "sudo make install" will typically copy the |
| 18 | 18 | # folder into /usr/local/include |
| 19 | -install(DIRECTORY ${CMAKE_SOURCE_DIR}/include/CppLinuxSerial DESTINATION include) | |
| 20 | 19 | \ No newline at end of file |
| 20 | +install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../include/CppLinuxSerial DESTINATION include) | ... | ... |