Commits

Anonymous committed 77995e1

Install directories are now controlled by cache variables.

Comments (0)

Files changed (4)

 cmake_minimum_required(VERSION 2.6)
 
-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) 
-set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) 
-set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
+set(CMAKE_BINARY_OUTPUT_DIRECTORY ${CMAKE_INSTALL_PREFIX}/bin CACHE STRING "Binary output directory")
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_INSTALL_PREFIX}/lib CACHE STRING "Library output directory")
+set(CMAKE_HEADER_OUTPUT_DIRECTORY ${CMAKE_INSTALL_PREFIX}/include CACHE STRING "Header output directory")
 
 set(BUILD_EXAMPLES TRUE CACHE BOOL "If true examples will be built")
 

examples/fibonacci/CMakeLists.txt

 add_executable(fibonacci ${SOURCES} ${HEADERS})
 target_link_libraries(fibonacci cppbench)
 
-install(TARGETS fibonacci DESTINATION bin)
+install(TARGETS fibonacci DESTINATION ${CMAKE_BINARY_OUTPUT_DIRECTORY})

examples/primes/CMakeLists.txt

 add_executable(prime ${SOURCES} ${HEADERS})
 target_link_libraries(prime cppbench)
 
-install(TARGETS prime DESTINATION bin)
+install(TARGETS prime DESTINATION ${CMAKE_BINARY_OUTPUT_DIRECTORY})

src/CMakeLists.txt

     target_link_libraries(cppbench ${RT_LIBRARY})
 endif ()
 
-install(TARGETS cppbench DESTINATION bin)
-install(DIRECTORY . DESTINATION include
+install(TARGETS cppbench DESTINATION ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
+install(DIRECTORY . DESTINATION ${CMAKE_HEADER_OUTPUT_DIRECTORY}
           FILES_MATCHING PATTERN "*.h*")
-