diff --git a/cmake/modules/BasicConfig.cmake b/cmake/modules/BasicConfig.cmake index 4a97f3d..174bfd1 100644 --- a/cmake/modules/BasicConfig.cmake +++ b/cmake/modules/BasicConfig.cmake @@ -3,11 +3,14 @@ # set project name (displayed in Qt Creator) project(${META_PROJECT_NAME}) -# might be useful so other projects built as part of the same subdirs project -# can access files from this project -set(${META_PROJECT_VARNAME}_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PARENT_SCOPE) -set(${META_PROJECT_VARNAME}_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}" PARENT_SCOPE) -set(${META_PROJECT_NAME}_DIR "${CMAKE_CURRENT_BINARY_DIR}" PARENT_SCOPE) +# provide variables for other projects built as part of the same subdirs project +# to access files from this project +get_directory_property(HAS_PARENT PARENT_DIRECTORY) +if(HAS_PARENT) + set(${META_PROJECT_VARNAME}_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PARENT_SCOPE) + set(${META_PROJECT_VARNAME}_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}" PARENT_SCOPE) + set(${META_PROJECT_NAME}_DIR "${CMAKE_CURRENT_BINARY_DIR}" PARENT_SCOPE) +endif() # stringify the meta data set(META_PROJECT_NAME_STR "\"${META_PROJECT_NAME}\"") diff --git a/cmake/modules/LibraryTarget.cmake b/cmake/modules/LibraryTarget.cmake index 8ac509d..65cd194 100644 --- a/cmake/modules/LibraryTarget.cmake +++ b/cmake/modules/LibraryTarget.cmake @@ -133,7 +133,7 @@ if(NOT TARGET install-binary-strip) endif() # add install target for header files -foreach(HEADER_FILE ${HEADER_FILES}) +foreach(HEADER_FILE ${HEADER_FILES} ${ADDITIONAL_HEADER_FILES}) get_filename_component(HEADER_DIR "${HEADER_FILE}" DIRECTORY) install( FILES "${HEADER_FILE}" @@ -193,26 +193,26 @@ endif() # add mingw-w64 specific install targets if(NOT TARGET install-mingw-w64) add_custom_target(install-mingw-w64 - DEPENDS install-binary install-header + DEPENDS install-binary install-header install-cmake-stuff ${LOCALIZATION_TARGET} ) endif() if(NOT TARGET install-mingw-w64-importlib-strip) add_custom_target(install-mingw-w64-importlib-strip DEPENDS install-binary-strip - COMMAND "${CMAKE_FIND_ROOT_PATH}/bin/strip" --strip-unneeded "${CMAKE_INSTALL_PREFIX}/lib/lib${META_PROJECT_NAME}.dll.a" + COMMAND "${CMAKE_FIND_ROOT_PATH}/bin/strip" --strip-unneeded "\$\{DESTDIR\}\$\{DESTDIR:+/\}${CMAKE_INSTALL_PREFIX}/lib/lib${META_PROJECT_NAME}.dll.a" ) endif() if(NOT TARGET install-mingw-w64-staticlib-strip) add_custom_target(install-mingw-w64-staticlib-strip DEPENDS install-binary-strip - COMMAND "${CMAKE_FIND_ROOT_PATH}/bin/strip" -g "${CMAKE_INSTALL_PREFIX}/lib/lib${META_PROJECT_NAME}.a" + COMMAND "${CMAKE_FIND_ROOT_PATH}/bin/strip" -g "\$\{DESTDIR\}\$\{DESTDIR:+/\}${CMAKE_INSTALL_PREFIX}/lib/lib${META_PROJECT_NAME}.a" ) endif() if(NOT TARGET install-mingw-w64-strip) add_custom_target(install-mingw-w64-strip - DEPENDS install-binary-strip install-mingw-w64-importlib-strip install-mingw-w64-staticlib-strip install-header + DEPENDS install-binary-strip install-mingw-w64-importlib-strip install-mingw-w64-staticlib-strip install-header install-cmake-stuff ${LOCALIZATION_TARGET} ) endif() diff --git a/cmake/modules/WindowsResources.cmake b/cmake/modules/WindowsResources.cmake index 009c6a0..40d6ba1 100644 --- a/cmake/modules/WindowsResources.cmake +++ b/cmake/modules/WindowsResources.cmake @@ -12,9 +12,9 @@ if(MINGW) elseif(EXISTS "${CPP_UTILITIES_SOURCE_DIR}/cmake/templates/windows.rc.in") # check sources of c++utilities set(RC_TEMPLATE_FILE "${CPP_UTILITIES_SOURCE_DIR}/cmake/templates/windows.rc.in") - elseif(EXISTS "${CMAKE_INSTALL_PREFIX}/share/c++utilities/cmake-templates/windows.rc.in") + elseif(EXISTS "${CMAKE_INSTALL_PREFIX}/share/c++utilities/cmake/templates/windows.rc.in") # check installed version of c++utilities - set(RC_TEMPLATE_FILE "${CMAKE_INSTALL_PREFIX}/share/c++utilities/cmake-templates/windows.rc.in") + set(RC_TEMPLATE_FILE "${CMAKE_INSTALL_PREFIX}/share/c++utilities/cmake/templates/windows.rc.in") else() message(FATAL_ERROR "Template for Windows *.rc file can not be located.") endif()