From ea241d85efdd5c5110e3e944b19501b5e7b9acbc Mon Sep 17 00:00:00 2001 From: Pieter van der Kloet Date: Sat, 28 Jan 2012 01:36:17 +0100 Subject: [PATCH] Fixed some issues with the CMake files --- apps/openmw/CMakeLists.txt | 41 ++++++++++++++++++-------------------- cmake/OpenMWMacros.cmake | 4 ++-- components/CMakeLists.txt | 8 ++++++-- 3 files changed, 27 insertions(+), 26 deletions(-) diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index bbee7498a..e9e548c0e 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -1,18 +1,16 @@ -project(OpenMW) # config file - -configure_file ("${OpenMW_SOURCE_DIR}/config.hpp.cmake" "${OpenMW_SOURCE_DIR}/config.hpp") +configure_file ("${CMAKE_CURRENT_SOURCE_DIR}/config.hpp.cmake" "${CMAKE_CURRENT_SOURCE_DIR}/config.hpp") # local files - set(GAME main.cpp engine.cpp - ) +) set(GAME_HEADER engine.hpp - config.hpp) + config.hpp +) source_group(game FILES ${GAME} ${GAME_HEADER}) add_openmw_dir (mwrender @@ -61,13 +59,11 @@ add_openmw_dir (mwmechanics # Main executable add_executable(openmw ${OPENMW_LIBS} ${OPENMW_LIBS_HEADER} - ${CONPONENT_FILES} + ${COMPONENT_FILES} ${OPENMW_FILES} ${GAME} ${GAME_HEADER} ${APPLE_BUNDLE_RESOURCES} - ) - -target_link_libraries (openmw components) +) # Sound stuff - here so CMake doesn't stupidly recompile EVERYTHING # when we change the backend. @@ -75,26 +71,27 @@ include_directories(${SOUND_INPUT_INCLUDES} ${BULLET_INCLUDE_DIRS}) add_definitions(${SOUND_DEFINE}) target_link_libraries(openmw - ${OGRE_LIBRARIES} - ${OIS_LIBRARIES} - ${Boost_LIBRARIES} - ${OPENAL_LIBRARY} - ${SOUND_INPUT_LIBRARY} - ${BULLET_LIBRARIES} - caelum - MyGUIEngine - MyGUIOgrePlatform + ${OGRE_LIBRARIES} + ${OIS_LIBRARIES} + ${Boost_LIBRARIES} + ${OPENAL_LIBRARY} + ${SOUND_INPUT_LIBRARY} + ${BULLET_LIBRARIES} + caelum + components + MyGUIEngine + MyGUIOgrePlatform ) -if (APPLE) +if(APPLE) find_library(CARBON_FRAMEWORK Carbon) target_link_libraries(openmw ${CARBON_FRAMEWORK}) install(TARGETS openmw BUNDLE DESTINATION . RUNTIME DESTINATION ../MacOS COMPONENT Runtime) -endif (APPLE) +endif(APPLE) if(DPKG_PROGRAM) INSTALL(TARGETS openmw RUNTIME DESTINATION games COMPONENT openmw) -endif() +endif(DPKG_PROGRAM) diff --git a/cmake/OpenMWMacros.cmake b/cmake/OpenMWMacros.cmake index c40936691..e79f9e615 100644 --- a/cmake/OpenMWMacros.cmake +++ b/cmake/OpenMWMacros.cmake @@ -2,7 +2,7 @@ macro (add_openmw_dir dir) set (files) foreach (u ${ARGN}) -file (GLOB ALL RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${dir}/${u}.*") +file (GLOB ALL ${CMAKE_CURRENT_SOURCE_DIR} "${dir}/${u}.*") foreach (f ${ALL}) list (APPEND files "${f}") list (APPEND OPENMW_FILES "${f}") @@ -14,7 +14,7 @@ endmacro (add_openmw_dir) macro (add_component_dir dir) set (files) foreach (u ${ARGN}) -file (GLOB ALL RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${dir}/${u}.*") +file (GLOB ALL ${CMAKE_CURRENT_SOURCE_DIR} "${dir}/${u}.*") foreach (f ${ALL}) list (APPEND files "${f}") list (APPEND COMPONENT_FILES "${f}") diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index 75b8aff8c..7fcac6eb8 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -63,6 +63,10 @@ add_component_dir (interpreter include_directories(${BULLET_INCLUDE_DIRS}) -add_library (components STATIC ${COMPONENT_FILES}) +add_library(components STATIC ${COMPONENT_FILES}) + +target_link_libraries(components ${Boost_LIBRARIES} ${OGRE_LIBRARIES}) + +# Make the variable accessible for other subdirectories +set(COMPONENT_FILES ${COMPONENT_FILES} PARENT_SCOPE) -target_link_libraries (components ${Boost_LIBRARIES} ${OGRE_LIBRARIES})