From d1c36d7b9664a2bde688cf06e600c4dad8055429 Mon Sep 17 00:00:00 2001 From: Lukas W Date: Tue, 19 Jun 2018 21:16:45 +0200 Subject: [PATCH] CMake: Fix errors when path contains spaces --- cmake/modules/BuildPlugin.cmake | 16 ++++++++-------- plugins/CMakeLists.txt | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cmake/modules/BuildPlugin.cmake b/cmake/modules/BuildPlugin.cmake index a107ef5ac39..f1dd95db6d3 100644 --- a/cmake/modules/BuildPlugin.cmake +++ b/cmake/modules/BuildPlugin.cmake @@ -7,7 +7,7 @@ MACRO(BUILD_PLUGIN PLUGIN_NAME) CMAKE_PARSE_ARGUMENTS(PLUGIN "" "" "MOCFILES;EMBEDDED_RESOURCES;UICFILES;LINK" ${ARGN}) SET(PLUGIN_SOURCES ${PLUGIN_UNPARSED_ARGUMENTS}) - INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src/gui) + INCLUDE_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_BINARY_DIR}" "${CMAKE_SOURCE_DIR}/include" "${CMAKE_SOURCE_DIR}/src/gui") ADD_DEFINITIONS(-DPLUGIN_NAME=${PLUGIN_NAME}) @@ -20,15 +20,15 @@ MACRO(BUILD_PLUGIN PLUGIN_NAME) FILE(GLOB EXPANDED "${ARG}") LIST(SORT EXPANDED) FOREACH(ITEM ${EXPANDED}) - LIST(APPEND NEW_ARGS ${ITEM}) + LIST(APPEND NEW_ARGS "${ITEM}") ENDFOREACH() ENDFOREACH() SET(PLUGIN_EMBEDDED_RESOURCES ${NEW_ARGS}) - SET(ER_H ${CMAKE_CURRENT_BINARY_DIR}/embedded_resources.h) + SET(ER_H "${CMAKE_CURRENT_BINARY_DIR}/embedded_resources.h") ADD_CUSTOM_COMMAND(OUTPUT ${ER_H} COMMAND ${BIN2RES} - ARGS ${PLUGIN_EMBEDDED_RESOURCES} > ${ER_H} + ARGS ${PLUGIN_EMBEDDED_RESOURCES} > "${ER_H}" DEPENDS bin2res) ENDIF(ER_LEN) @@ -45,11 +45,11 @@ MACRO(BUILD_PLUGIN PLUGIN_NAME) ENDFOREACH(f) IF(LMMS_BUILD_APPLE) - LINK_DIRECTORIES(${CMAKE_BINARY_DIR}) + LINK_DIRECTORIES("${CMAKE_BINARY_DIR}") LINK_LIBRARIES(${QT_LIBRARIES}) ENDIF(LMMS_BUILD_APPLE) IF(LMMS_BUILD_WIN32) - LINK_DIRECTORIES(${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}) + LINK_DIRECTORIES("${CMAKE_BINARY_DIR}" "${CMAKE_SOURCE_DIR}") LINK_LIBRARIES(${QT_LIBRARIES}) ENDIF(LMMS_BUILD_WIN32) IF(LMMS_BUILD_MSYS AND CMAKE_BUILD_TYPE STREQUAL "Debug") @@ -73,12 +73,12 @@ MACRO(BUILD_PLUGIN PLUGIN_NAME) INSTALL(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION "${PLUGIN_DIR}") IF(LMMS_BUILD_APPLE) - SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES LINK_FLAGS "-bundle_loader ${CMAKE_BINARY_DIR}/lmms") + SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES LINK_FLAGS "-bundle_loader \"${CMAKE_BINARY_DIR}/lmms\"") ADD_DEPENDENCIES(${PLUGIN_NAME} lmms) ENDIF(LMMS_BUILD_APPLE) IF(LMMS_BUILD_WIN32) SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES PREFIX "") - ADD_CUSTOM_COMMAND(TARGET ${PLUGIN_NAME} POST_BUILD COMMAND ${STRIP} $) + ADD_CUSTOM_COMMAND(TARGET ${PLUGIN_NAME} POST_BUILD COMMAND ${STRIP} "$") ENDIF(LMMS_BUILD_WIN32) SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${ER_H} ${plugin_MOC_out}") diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 24c15e391bd..4a119688634 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -1,5 +1,5 @@ -SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) -SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) +SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") +SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") # Enable C++11 ADD_DEFINITIONS(-std=c++0x)