[Orxonox-commit 3126] r7820 - in code/forks/sandbox_qt: cmake/tools src

rgrieder at orxonox.net rgrieder at orxonox.net
Sun Dec 26 21:16:53 CET 2010


Author: rgrieder
Date: 2010-12-26 21:16:53 +0100 (Sun, 26 Dec 2010)
New Revision: 7820

Modified:
   code/forks/sandbox_qt/cmake/tools/SourceFileUtilities.cmake
   code/forks/sandbox_qt/cmake/tools/TargetUtilities.cmake
   code/forks/sandbox_qt/src/CMakeLists.txt
Log:
Fixed problem with files directly supplied to ORXONOX_ADD_TARGET.

Modified: code/forks/sandbox_qt/cmake/tools/SourceFileUtilities.cmake
===================================================================
--- code/forks/sandbox_qt/cmake/tools/SourceFileUtilities.cmake	2010-12-26 20:12:31 UTC (rev 7819)
+++ code/forks/sandbox_qt/cmake/tools/SourceFileUtilities.cmake	2010-12-26 20:16:53 UTC (rev 7820)
@@ -41,7 +41,7 @@
     ELSE()
       # Store file with path relative to the root source directory
       FILE(RELATIVE_PATH _file_rel ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${_file})
-      LIST(APPEND _source_files ${_file_rel})
+      LIST(APPEND _source_files ./${_file_rel})
     ENDIF()
   ENDFOREACH(_file)
   SET(_source_files ${_source_files} PARENT_SCOPE)

Modified: code/forks/sandbox_qt/cmake/tools/TargetUtilities.cmake
===================================================================
--- code/forks/sandbox_qt/cmake/tools/TargetUtilities.cmake	2010-12-26 20:12:31 UTC (rev 7819)
+++ code/forks/sandbox_qt/cmake/tools/TargetUtilities.cmake	2010-12-26 20:16:53 UTC (rev 7820)
@@ -124,7 +124,21 @@
       SET(_compile_qt_next TRUE)
     ELSE()
       # Default, add source file
-      SET(_file ${CMAKE_SOURCE_DIR}/${_file})
+
+      # Prepare relative paths
+      IF(NOT _file MATCHES "^(.\\:|\\/)")
+        # Path can be relative to the current source directory if the file was
+        # not added with the source file macros. Otherwise there is a "./" at
+        # the beginning of each file and the filename is relative
+        # to the CMAKE_SOURCE_DIR
+        STRING(REGEX REPLACE "^\\.\\/(.+)$" "\\1" _temp ${_file})
+        IF(NOT ${_temp} STREQUAL ${_file})
+          SET(_file ${CMAKE_SOURCE_DIR}/${_temp})
+        ELSE()
+          SET(_file ${CMAKE_CURRENT_SOURCE_DIR}/${_file})
+        ENDIF()
+      ENDIF()
+
       LIST(APPEND _${_target_name}_source_files ${_file})
 
       # Handle compilations

Modified: code/forks/sandbox_qt/src/CMakeLists.txt
===================================================================
--- code/forks/sandbox_qt/src/CMakeLists.txt	2010-12-26 20:12:31 UTC (rev 7819)
+++ code/forks/sandbox_qt/src/CMakeLists.txt	2010-12-26 20:16:53 UTC (rev 7820)
@@ -78,8 +78,6 @@
 
 ################## Executable ###################
 
-SET_SOURCE_FILES(ORXONOX_MAIN_SRC_FILES Orxonox.cc)
-
 INCLUDE_DIRECTORIES(
   ${CMAKE_CURRENT_SOURCE_DIR}/libraries
   ${CMAKE_CURRENT_SOURCE_DIR}/orxonox
@@ -97,7 +95,7 @@
     ${QT_QTMAIN_LIBRARY}
     orxonox
   SOURCE_FILES
-    ${ORXONOX_MAIN_SRC_FILES}
+    Orxonox.cc
   OUTPUT_NAME orxonox
 )
 




More information about the Orxonox-commit mailing list