[CMake] CMAKE_SOURCE_DIR overwritten by CMake Fortran language support

Brad King brad.king at kitware.com
Mon Mar 29 09:04:01 EDT 2010


Arjen Markus wrote:
> Hi Alan,
> 
> I have no time today to really dig into the output, but while
> CMAKE_HOMEDIRECTORY points to the right directory, the outcome is
> the same: the "wrong" information file gets loaded.
> 
> I will send the detailed output from cmake --trace in a separate
> mail (> 0.5 MB).

The debug line that you added:

  message("DEBUG: ${CMAKE_SOURCE_DIR}/cmake/modules/language-support/cmake-2.6/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_Fortran_COMPILER_ID}-Fortran.cmake")

seems to run only in the sub-project that executes inside a different
cmake instance, executed by the outer cmake here:

  F:/plplot-svn/plplot/cmake/modules/language_support.cmake(89):  execute_process(COMMAND ${CMAKE_COMMAND} -G ${CMAKE_GENERATOR} . WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/language_tests/${language} RESULT_VARIABLE return_code )

The output of the message appears only once:

  DEBUG: F:/plplot-svn/build-mingw-test-cmake/language_tests/Fortran/cmake/modules/language-support/cmake-2.6/Platform/Windows-GNU-Fortran.cmake

That looks to me like CMAKE_SOURCE_DIR points exactly where it should:

  WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/language_tests/${language}

This is different from the outer CMake's CMAKE_SOURCE_DIR because
it is a different process.

-Brad


More information about the CMake mailing list