diff --git a/CMakeLists.txt b/CMakeLists.txt index 09ad95ef5..a552d0181 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,7 +49,7 @@ set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Add a path for any locally-supplied CMake modules # These would typically be a part of any custom PSPs in use. # (this is not required, and the directory can be empty/nonexistent) -set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/../psp/cmake/Modules" ${CMAKE_MODULE_PATH}) +set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../psp/cmake/Modules" ${CMAKE_MODULE_PATH}) # The minimum CMake version is chosen because 2.6.4 is what is # included by default with RHEL/Centos 5.x @@ -59,7 +59,8 @@ cmake_minimum_required(VERSION 2.6.4) # that the subdirectories will at least use the "C" language, so # indicate that now. Doing this early initializes the CFLAGS # so they won't change later. -project(CFETOP C) +# Note: this line defines the CFE_SOURCE_DIR variable. +project(CFE C) # Allow unit tests to be added by any recipe enable_testing() diff --git a/cmake/mission_build.cmake b/cmake/mission_build.cmake index 5b767e74e..446860bd6 100644 --- a/cmake/mission_build.cmake +++ b/cmake/mission_build.cmake @@ -36,7 +36,7 @@ function(initialize_globals) # this is the parent (mission) build and variable values must be determined # Obtain the "real" top-level source directory and set it in parent scope if (NOT DEFINED MISSION_SOURCE_DIR) - get_filename_component(MISSION_SOURCE_DIR "${CMAKE_SOURCE_DIR}/.." ABSOLUTE) + get_filename_component(MISSION_SOURCE_DIR "${CFE_SOURCE_DIR}/.." ABSOLUTE) set(MISSION_SOURCE_DIR ${MISSION_SOURCE_DIR} CACHE PATH "Top level mission source directory") endif(NOT DEFINED MISSION_SOURCE_DIR) @@ -211,13 +211,13 @@ function(prepare) file(WRITE "${CMAKE_BINARY_DIR}/doc/mission-content.doxyfile" ${MISSION_DOXYFILE_USER_CONTENT}) - configure_file("${CMAKE_SOURCE_DIR}/cmake/cfe-common.doxyfile.in" + configure_file("${CFE_SOURCE_DIR}/cmake/cfe-common.doxyfile.in" "${CMAKE_BINARY_DIR}/doc/cfe-common.doxyfile") - configure_file("${CMAKE_SOURCE_DIR}/cmake/osal-common.doxyfile.in" + configure_file("${CFE_SOURCE_DIR}/cmake/osal-common.doxyfile.in" "${CMAKE_BINARY_DIR}/doc/osal-common.doxyfile") - configure_file("${CMAKE_SOURCE_DIR}/cmake/mission-detaildesign.doxyfile.in" + configure_file("${CFE_SOURCE_DIR}/cmake/mission-detaildesign.doxyfile.in" "${CMAKE_BINARY_DIR}/doc/mission-detaildesign.doxyfile") # The user guide should include the doxygen from the _public_ API files from CFE + OSAL @@ -239,10 +239,10 @@ function(prepare) set(OSALGUIDE_PREDEFINED "MESSAGE_FORMAT_IS_CCSDS") - configure_file("${CMAKE_SOURCE_DIR}/cmake/cfe-usersguide.doxyfile.in" + configure_file("${CFE_SOURCE_DIR}/cmake/cfe-usersguide.doxyfile.in" "${CMAKE_BINARY_DIR}/doc/cfe-usersguide.doxyfile") - configure_file("${CMAKE_SOURCE_DIR}/cmake/osalguide.doxyfile.in" + configure_file("${CFE_SOURCE_DIR}/cmake/osalguide.doxyfile.in" "${CMAKE_BINARY_DIR}/doc/osalguide.doxyfile") add_custom_target(mission-doc @@ -294,7 +294,7 @@ function(prepare) add_custom_target(mission-version COMMAND ${CMAKE_COMMAND} -D BIN=${CMAKE_BINARY_DIR} - -P ${CMAKE_SOURCE_DIR}/cmake/version.cmake + -P ${CFE_SOURCE_DIR}/cmake/version.cmake WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} ) @@ -337,8 +337,8 @@ function(process_arch TARGETSYSTEM) # Find the toolchain file - allow a file in the mission defs dir to supercede one in the compile dir if (EXISTS ${MISSION_DEFS}/toolchain-${CURRSYS}.cmake) set(TOOLCHAIN_FILE ${MISSION_DEFS}/toolchain-${CURRSYS}.cmake) - elseif(EXISTS ${CMAKE_SOURCE_DIR}/cmake/toolchain-${CURRSYS}.cmake) - set(TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchain-${CURRSYS}.cmake) + elseif(EXISTS ${CFE_SOURCE_DIR}/cmake/toolchain-${CURRSYS}.cmake) + set(TOOLCHAIN_FILE ${CFE_SOURCE_DIR}/cmake/toolchain-${CURRSYS}.cmake) else() message(FATAL_ERROR "Unable to find toolchain file for ${CURRSYS}") endif() @@ -357,7 +357,7 @@ function(process_arch TARGETSYSTEM) -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} ${SELECTED_TOOLCHAIN_FILE} - ${CMAKE_SOURCE_DIR} + ${CFE_SOURCE_DIR} WORKING_DIRECTORY "${ARCH_BINARY_DIR}" RESULT_VARIABLE