[CMake] Build only what you need in third party libs

Brian Davis bitminer at gmail.com
Thu Jan 28 17:23:51 EST 2010


Update: currently crying uncle ... and switching to ExternalProject_Add.
CMake and the third party libs were simply not designed for this.

Question on ExternalProject_Add above:

ExternalProject_Add(
  DOWNLOAD_COMMAND ""
  CMAKE_ARGS
    -DMYPROJ_UBERBUILD:BOOL=OFF
  SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}
  ...
)

I had in my project:

SET( THIRD_PARTY_SRC_DIR  3rdParty/Win )
add_subdirectory( ${THIRD_PARTY_SRC_DIR}/vtk-5.4.2 ./vtk-5.4.2  )

and so I replaced it with:

ExternalProject_Add(
    vtk-5.4.2
    DOWNLOAD_COMMAND ""
    SOURCE_DIR ${THIRD_PARTY_SRC_DIR}/vtk-5.4.2
#    SOURCE_DIR
C:\projects\NIH2009\source\branches\trunk\source\cpp\lib\3rdParty\Win\vtk-5.4.2
    SOURCE_DIR /source/cpp/lib/3rdParty/Win/vtk-5.4.2

)

Where these lines are in a CMakeLists.txt file located at:

C:\projects\NIH2009\source\branches\trunk\source\cpp\lib\CMakeLists.txt

but I get the error in Visual Studio:

2>CMake Error: The source directory
"C:/projects/NIH2009/source/branches/trunk/build/dvip4-Win64/cpp_source/lib/3rdParty/Win/vtk-5.4.2"
does not appear to contain CMakeLists.txt.

Note the prefixing of
C:/projects/NIH2009/source/branches/trunk/build/dvip4-Win64/cpp_source/lib

vtk is located at
C:\projects\NIH2009\source\branches\trunk\source\cpp\lib\3rdParty\Win\vtk-5.4.2

and project root CMakeLists.txt is at
C:\projects\NIH2009\source\branches\trunk



ExternalProject_Add(
    vtk-5.4.2
    DOWNLOAD_COMMAND ""
    SOURCE_DIR /source/cpp/lib/3rdParty/Win/vtk-5.4.2

)

and get:

2>CMake Error: The source directory "/source/cpp/lib/3rdParty/Win/vtk-5.4.2"
does not appear to contain CMakeLists.txt.

so I try:

SOURCE_DIR /3rdParty/Win/vtk-5.4.2

2>CMake Error: The source directory "/3rdParty/Win/vtk-5.4.2" does not
appear to contain CMakeLists.txt.


so I try absolute path:


ExternalProject_Add(
    vtk-5.4.2
    DOWNLOAD_COMMAND ""
    SOURCE_DIR
C:\projects\NIH2009\source\branches\trunk\source\cpp\lib\3rdParty\Win\vtk-5.4.2
}

Ahhh the hacking... I am going to find my way out of this forest one day...
and onto a desert.

And now CMake finds the vtk goop.   Now the question: Is there a project
relative directory syntax to use here or is ExternalProject not like
add_subdirectory in this regard?

-- 
Brian J. Davis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100128/c3c59844/attachment.htm>


More information about the CMake mailing list