#------------------------------------------------------------------- # This file is part of the CMake build system for Hydrax # # The contents of this file are placed in the public domain. Feel # free to make use of it in any way you like. #------------------------------------------------------------------- # Configure settings and install targets if (WIN32) set(HYDRAX_RELEASE_PATH "/Release") set(HYDRAX_RELWDBG_PATH "/RelWithDebInfo") set(HYDRAX_MINSIZE_PATH "/MinSizeRel") set(HYDRAX_DEBUG_PATH "/Debug") set(HYDRAX_LIB_RELEASE_PATH "/Release") set(HYDRAX_LIB_RELWDBG_PATH "/RelWithDebInfo") set(HYDRAX_LIB_MINSIZE_PATH "/MinSizeRel") set(HYDRAX_LIB_DEBUG_PATH "/Debug") set(HYDRAX_SAMPLE_PATH "/opt/samples") elseif (UNIX) set(HYDRAX_RELEASE_PATH "") set(HYDRAX_RELWDBG_PATH "") set(HYDRAX_MINSIZE_PATH "") set(HYDRAX_DEBUG_PATH "/debug") set(HYDRAX_LIB_RELEASE_PATH "") set(HYDRAX_LIB_RELWDBG_PATH "") set(HYDRAX_LIB_MINSIZE_PATH "") set(HYDRAX_LIB_DEBUG_PATH "") set(HYDRAX_SAMPLE_PATH "/HYDRAX/Samples") endif () # create vcproj.user file for Visual Studio to set debug working directory function(hydrax_create_vcproj_userfile TARGETNAME) if (MSVC) configure_file( ${HYDRAX_TEMPLATES_DIR}/VisualStudioUserFile.vcproj.user.in ${CMAKE_CURRENT_BINARY_DIR}/${TARGETNAME}.vcproj.user @ONLY ) endif () endfunction(hydrax_create_vcproj_userfile) # install targets according to current build type function(hydrax_install_target TARGETNAME SUFFIX) install(TARGETS ${TARGETNAME} BUNDLE DESTINATION "bin${HYDRAX_RELEASE_PATH}" CONFIGURATIONS Release None "" RUNTIME DESTINATION "bin${HYDRAX_RELEASE_PATH}" CONFIGURATIONS Release None "" LIBRARY DESTINATION "lib${HYDRAX_LIB_RELEASE_PATH}${SUFFIX}" CONFIGURATIONS Release None "" ARCHIVE DESTINATION "lib${HYDRAX_LIB_RELEASE_PATH}${SUFFIX}" CONFIGURATIONS Release None "" FRAMEWORK DESTINATION "bin${HYDRAX_RELEASE_PATH}" CONFIGURATIONS Release None "" ) install(TARGETS ${TARGETNAME} BUNDLE DESTINATION "bin${HYDRAX_RELWDBG_PATH}" CONFIGURATIONS RelWithDebInfo RUNTIME DESTINATION "bin${HYDRAX_RELWDBG_PATH}" CONFIGURATIONS RelWithDebInfo LIBRARY DESTINATION "lib${HYDRAX_LIB_RELWDBG_PATH}${SUFFIX}" CONFIGURATIONS RelWithDebInfo ARCHIVE DESTINATION "lib${HYDRAX_LIB_RELWDBG_PATH}${SUFFIX}" CONFIGURATIONS RelWithDebInfo FRAMEWORK DESTINATION "bin${HYDRAX_RELWDBG_PATH}" CONFIGURATIONS RelWithDebInfo ) install(TARGETS ${TARGETNAME} BUNDLE DESTINATION "bin${HYDRAX_MINSIZE_PATH}" CONFIGURATIONS MinSizeRel RUNTIME DESTINATION "bin${HYDRAX_MINSIZE_PATH}" CONFIGURATIONS MinSizeRel LIBRARY DESTINATION "lib${HYDRAX_LIB_MINSIZE_PATH}${SUFFIX}" CONFIGURATIONS MinSizeRel ARCHIVE DESTINATION "lib${HYDRAX_LIB_MINSIZE_PATH}${SUFFIX}" CONFIGURATIONS MinSizeRel FRAMEWORK DESTINATION "bin${HYDRAX_MINSIZE_PATH}" CONFIGURATIONS MinSizeRel ) install(TARGETS ${TARGETNAME} BUNDLE DESTINATION "bin${HYDRAX_DEBUG_PATH}" CONFIGURATIONS Debug RUNTIME DESTINATION "bin${HYDRAX_DEBUG_PATH}" CONFIGURATIONS Debug LIBRARY DESTINATION "lib${HYDRAX_LIB_DEBUG_PATH}${SUFFIX}" CONFIGURATIONS Debug ARCHIVE DESTINATION "lib${HYDRAX_LIB_DEBUG_PATH}${SUFFIX}" CONFIGURATIONS Debug FRAMEWORK DESTINATION "bin${HYDRAX_DEBUG_PATH}" CONFIGURATIONS Debug ) endfunction(hydrax_install_target) # setup common target settings function(hydrax_config_common TARGETNAME) if (NOT IOS) set_target_properties(${TARGETNAME} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${HYDRAX_BINARY_DIR}/lib LIBRARY_OUTPUT_DIRECTORY ${HYDRAX_BINARY_DIR}/lib RUNTIME_OUTPUT_DIRECTORY ${HYDRAX_BINARY_DIR}/bin ) endif() hydrax_create_vcproj_userfile(${TARGETNAME}) endfunction(hydrax_config_common) # setup library build function(hydrax_config_lib LIBNAME) hydrax_config_common(${LIBNAME}) if(HYDRAX_STATIC) # add static prefix, if compiling static version set_target_properties(${LIBNAME} PROPERTIES OUTPUT_NAME ${LIBNAME}Static) else(HYDRAX_STATIC) # add GCC visibility flags to shared library build if (CMAKE_COMPILER_IS_GNUCXX) set_target_properties(${LIBNAME} PROPERTIES COMPILE_FLAGS "${HYDRAX_GCC_VISIBILITY_FLAGS}") endif (CMAKE_COMPILER_IS_GNUCXX) endif() hydrax_install_target(${LIBNAME} "") endfunction(hydrax_config_lib) # setup Hydrax sample build function(hydrax_config_sample_common SAMPLENAME) hydrax_config_common(${SAMPLENAME}) # set install RPATH for Unix systems if (UNIX AND HYDRAX_FULL_RPATH) set_property(TARGET ${SAMPLENAME} APPEND PROPERTY INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib) set_property(TARGET ${SAMPLENAME} PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE) endif () if(NOT HYDRAX_STATIC) # add GCC visibility flags to shared library build if (CMAKE_COMPILER_IS_GNUCXX) set_target_properties(${SAMPLENAME} PROPERTIES COMPILE_FLAGS "${HYDRAX_GCC_VISIBILITY_FLAGS}") # disable "lib" prefix on Unix set_target_properties(${SAMPLENAME} PROPERTIES PREFIX "") endif (CMAKE_COMPILER_IS_GNUCXX) endif(NOT HYDRAX_STATIC) hydrax_install_target(${SAMPLENAME} ${HYDRAX_SAMPLE_PATH}) endfunction(hydrax_config_sample_common) function(hydrax_config_sample_exe SAMPLENAME) hydrax_config_sample_common(${SAMPLENAME}) endfunction(hydrax_config_sample_exe)