allow modified install paths

and make them consistent between static/shared builds.

Long term, consider using:
https://cmake.org/cmake/help/v3.0/module/GNUInstallDirs.html

issue #295
This commit is contained in:
Rex Dieter 2015-11-13 12:33:27 -06:00
parent 4ffd0fad63
commit ea7828fca3

View file

@ -138,6 +138,15 @@ if (MSVC)
list(APPEND LIBHFILES ${SRCDIR}/sprtf.h) list(APPEND LIBHFILES ${SRCDIR}/sprtf.h)
endif () endif ()
####################################### #######################################
if (NOT LIB_INSTALL_DIR)
set(LIB_INSTALL_DIR lib${LIB_SUFFIX})
endif ()
if (NOT BIN_INSTALL_DIR)
set(BIN_INSTALL_DIR bin)
endif ()
# Always build the STATIC library # Always build the STATIC library
set(name tidy-static) set(name tidy-static)
add_library ( ${name} STATIC ${CFILES} ${HFILES} ${LIBHFILES} ) add_library ( ${name} STATIC ${CFILES} ${HFILES} ${LIBHFILES} )
@ -146,9 +155,9 @@ set_target_properties( ${name} PROPERTIES
) )
list ( APPEND add_LIBS ${name} ) list ( APPEND add_LIBS ${name} )
install(TARGETS ${name} install(TARGETS ${name}
RUNTIME DESTINATION bin RUNTIME DESTINATION ${BIN_INSTALL_DIR}
ARCHIVE DESTINATION lib ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
LIBRARY DESTINATION lib LIBRARY DESTINATION ${LIB_INSTALL_DIR}
) )
install( FILES ${HFILES} DESTINATION include ) install( FILES ${HFILES} DESTINATION include )
######################################## ########################################
@ -166,11 +175,11 @@ if (BUILD_SHARED_LIB)
set_target_properties( ${name} PROPERTIES set_target_properties( ${name} PROPERTIES
COMPILE_FLAGS "-DBUILDING_SHARED_LIB" ) COMPILE_FLAGS "-DBUILDING_SHARED_LIB" )
install(TARGETS ${name} install(TARGETS ${name}
RUNTIME DESTINATION bin RUNTIME DESTINATION ${BIN_INSTALL_DIR}
ARCHIVE DESTINATION lib ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
LIBRARY DESTINATION lib LIBRARY DESTINATION ${LIB_INSTALL_DIR}
) )
endif () endif ()
########################################################## ##########################################################
### main executable - linked with STATIC library ### main executable - linked with STATIC library