Note that there are some explanatory texts on larger screens.

plurals
  1. POProblem with using Cmake in sub directories after once using cmake on the entire project
    text
    copied!<p>I have a head folder called Tutorial and sub folder called MathFunctions each having one code each I wrote CMakeLists.txt for both the folders and used cmake in cmd promptand it is working fine.</p> <p>CMakeLists.txt in head folder has the following:</p> <pre><code>CMAKE_MINIMUM_REQUIRED ( VERSION 2.6) PROJECT (Tutorial) SET (Tutorial_VERSION_MAJOR 1) SET (Tutorial_VERSION_MINOR 0) CONFIGURE_FILE ( "${PROJECT_SOURCE_DIR}/TutorialConfig.h.in" "${PROJECT_BINARY_DIR}/TutorialConfig.h " ) INCLUDE_DIRECTORIES ("${PROJECT_BINARY_DIR}") OPTION (USE_MYMATH "Use tutorial provided math implementation" ON) if (USE_MYMATH) INCLUDE_DIRECTORIES ("${PROJECT_SOURCE_DIR}/MathFunctions") ADD_SUBDIRECTORY (MathFunctions) SET (EXTRA_LIBS ${EXTRA_LIBS} MathFunctions) endif (USE_MYMATH) ADD_EXECUTABLE (Tutorial tutorial.c) TARGET_LINK_LIBRARIES (Tutorial ${EXTRA_LIBS}) </code></pre> <p>CMakeLists.txt in sub folder has the following:</p> <pre><code>CMAKE_MINIMUM_REQUIRED ( VERSION 2.6) add_library (MathFunctions mysqrt.c ) </code></pre> <p>and in command prompt :</p> <pre><code>C:\home\Tutorial\BUILD&gt;cmake .. -- Building for: Visual Studio 9 2008 -- Check for working C compiler using: Visual Studio 9 2008 -- Check for working C compiler using: Visual Studio 9 2008 -- -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler using: Visual Studio 9 2008 -- Check for working CXX compiler using: Visual Studio 9 2008 -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Configuring done -- Generating done -- Build files have been written to: C:/home/Tutorial/BUILD </code></pre> <p>Later I made some modifications in MathFunctions.c .I made no changes in Tutorial.c. So i want to re generate make files only for MathFunctions folder. But I am not able to do it. I am getting the following error</p> <pre><code>C:\home\Tutorial\BUILD&gt;cmake ../MathFunctions </code></pre> <p>CMake Error: The source "C:/home/Tutorial/MathFunctions/CMakeLists.txt" does not match the source "C:/home/Tutorial/CMakeLists.txt" used to generate cache. Re-run cmake with a different source directory.</p> <p>I cannot figure out why this error is coming. Please help Thanks</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload