<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">Lars,</span><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">When faced with this same problem, my workaround was to clear the list of include directories. It also turned out I needed to clear the compiler definitions passed with -D because nvcc choked on them. Here's how you do that.</div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px"><div>SET_DIRECTORY_PROPERTIES( PROPERTIES INCLUDE_DIRECTORIES "" )<br></div><div>SET_DIRECTORY_PROPERTIES( PROPERTIES COMPILE_DEFINITIONS "" )<br>
</div><div><br></div></div><div style="font-family:arial,sans-serif;font-size:13px">After these lines, you can again define includes and definitions needed for your CUDA library with include_directories, etc.</div><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px">You may have to make sure this library is in a subdirectory for this to work. That's what I had to do, but it looks like your library may already be in its own subdirectory, in which case clearing the include directories and compiler definitions should be sufficient.</div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Hope that helps,</div><div style="font-family:arial,sans-serif;font-size:13px">Cory</div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Fri, Nov 22, 2013 at 7:36 AM, Lars Friedrich Lars <span dir="ltr"><<a href="mailto:lars-friedrich@gmx.net" target="_blank">lars-friedrich@gmx.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div style="font-family:Verdana;font-size:12.0px"><div>Hello,</div>
<div> </div>
<div>we're compiling CUDA code in a sub-library of a bigger project which depends on ITK, VTK, Qt, RTK and a further proprietary library.</div>
<div> </div>
<div>The CMakeLists.txt of this sub-library looks somehow like this:</div>
<div> </div>
<div>
<div>#====================================================================</div>
<div>
<div>SET(OWN_LIB_NAME CBCTUtils)</div>
<div>SET(${OWN_LIB_NAME}_HDRS<br>
...<br>
oraCudaImagingRingPerspectiveReorientationFilter.h<br>
)</div>
<div>SET(${OWN_LIB_NAME}_SRCS<br>
...<br>
oraCudaImagingRingPerspectiveReorientationFilter.cxx<br>
)</div>
<div>CUDA_COMPILE(${OWN_LIB_NAME}_CUDA<br>
oraCudaImagingRingPerspectiveReorientationFilter.hcu<br>
oraCudaImagingRingPerspectiveReorientationFilter.cu<br>
)</div>
<div># include dirs</div>
<div>INCLUDE_DIRECTORIES(<br>
${CBCT_BIN_DIR}<br>
${CBCT_SOURCE_DIR}<br>
${RTK_INCLUDE_DIRS}<br>
${RTK_LIBRARY_DIRS}<br>
)</div>
<div># add utilities library</div>
<div>ADD_LIBRARY(${OWN_LIB_NAME} STATIC<br>
${${OWN_LIB_NAME}_SRCS}<br>
${${OWN_LIB_NAME}_HDRS}<br>
${${OWN_LIB_NAME}_CUDA}<br>
)</div>
<div>SET_TARGET_PROPERTIES(${OWN_LIB_NAME} PROPERTIES LINKER_LANGUAGE CXX)</div>
<div>TARGET_LINK_LIBRARIES(${OWN_LIB_NAME}<br>
${RTK_LIBS}<br>
${CUDA_LIBRARIES}<br>
${CUDA_cufft_LIBRARY}<br>
${OPENCL_LIBRARIES}<br>
ITKCommon<br>
ITKNumerics<br>
ORAIFTools<br>
ORAIFImageAccess<br>
ORAIFNReg2D3DDRREngine<br>
ORAIFNReg2D3DMathMethods<br>
ORAIFNReg2D3DAlgorithm<br>
ExperimentalORAIFImagingRing<br>
)</div>
<div># unit test</div>
<div>IF(CBCT_BUILD_TESTING)<br>
ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/testing)<br>
ENDIF(CBCT_BUILD_TESTING)</div>
</div>
<div>#====================================================================</div>
<div> </div>
<div>The problem is that obviously the underlying generated cl.exe call is incredibly long:</div>
<div> </div>
<div>cl.exe -D__CUDA_ARCH__=100 -nologo -E -TP -DCUDA_FLOAT_MATH_FUNCTIONS -DCUDA_NO_SM_11_ATOMIC_INTRINSICS<br>
-DCUDA_NO_SM_12_ATOMIC_INTRINSICS -DCUDA_NO_SM_13_DOUBLE_INTRINSICS -D__CUDACC__ /DWIN32 /D_WINDOWS /W3 /Zm1000 /GR<br>
/EHsc -DNOMINMAX /MD /O2 /Ob2 /D NDEBUG -I"C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v4.2/include"<br>
-I"C:/dev-libs/gdcm-2.0.14-64bit-build" -I"C:/dev-libs/itk-3.20.1/Code/Review"<br>
-I"C:/dev-libs/itk-3.20.1-64bit-review-build/Utilities/vxl/core"<br>
... -I"C:/QtSDK/Qt4.8.3-64bit/include/QtGui" -I"C:/QtSDK/Qt4.8.3-64bit/include/QtNetwork"<br>
-I"C:/QtSDK/Qt4.8.3-64bit/include/QtCore" -I"C:/QtSDK/Qt4.8.3-64bit/include"<br>
-I"C:/QtSDK/Qt4.8.3-64bit/include/QtGui" -I"C:/QtSDK/Qt4.8.3-64bit/include/QtNetwork"<br>
-I"C:/QtSDK/Qt4.8.3-64bit/include/QtCore" -I"C:/dev/ORA-CBCT-64bit-build"<br>
...<br>
...<br>
...<br>
-I"C:/dev/ORA-CBCT-64bit-build" -I"C:/dev/ORA-CBCT-64bit-build"<br>
-I"C:/dev/ORA-CBCT/trunk/tools" -I"C:/dev/ORA-CBCT/trunk/core"<br>
-I"C:/dev/ORA-CBCT/trunk/core/utils" -I"C:/dev/ORA-CBCT/trunk/gui" "<br>
-IC:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v4.2/bin/../include" "<br>
-IC:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v4.2/bin/../include/cudart" -D "__CUDACC__" -D "QT_DLL"<br>
-D "QT_GUI_LIB" -D "QT_NETWORK_LIB" -D "QT_CORE_LIB" -D "QT_DLL" -D "QT_GUI_LIB" -D "QT_NETWORK_LIB"<br>
-D "QT_CORE_LIB" -D "NVCC" -FI "cuda_runtime.h" "C:/dev/ORA-CBCT/trunk/core/utils/oraCudaImagingRingPerspectiveReorientationFilter.cu" > "C:/Users/RA-Admin/AppData/Local/Temp/tmpxft_00001cdc_00000000-7_oraCudaImagingRingPerspectiveReorientationFilter.cpp1.ii"</div>
<div> </div>
<div>(more than 9000 characters - which is obviously too long for cl.exe "The command line is too long.")</div>
<div> </div>
<div> </div>
<div>Many of the implied included directories (which are automatically derived by CMake) are definitely not required for compiling this library - cross-checked this on the command line manually.</div>
<div> </div>
<div>Is it possible to control (manipulate?) the generated includes in this call by invoking the one other cmake macro? Is there some other workaround besides from placing the source code of the dependent libs in folds such "C:\a" a.s.o. in order to get the resultant string shorter?</div>
<div> </div>
<div>Thanks.</div><span class="HOEnZb"><font color="#888888">
<div> </div>
<div>Lars</div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
</font></span></div>
<div> </div></div></div>
<br>--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br></blockquote></div><br></div>