Hi forum, I am quite new to CMake tool. The application execution file that i am generating using CMake is stored in a separate directory and the execution reads an external file and store another external file inside the source root. I set the path for it.
But it seems that it is not getting the external files. For example inside the source i have main.cpp , the external input file to read - main.cl. When i compile the source the generated execution file is stored in another directory called bin. I go inside bin and run the execution and then it says that "No file found to read from as main.cl". Then if i put the input file inside bin it works fine. I do not want to have it this way. I want CMake direct the application to look for input files from the source directory and save file as well inside the source directory. I am attaching my current CMakeLists.txt for your kind review and looking forward to some hint to get around this issue. Regards Sajjad
######################################################################### # Set target name und set path to data folder of the target ######################################################################### SET(TARGETNAME osgOpenCLEndiannessDemo) SET(TARGET_DATA_PATH "${DATA_PATH}/${TARGETNAME}") ######################################################################### # Do necessary checking stuff (check for other libraries to link against ...) ######################################################################### # find osg INCLUDE(Findosg) INCLUDE(FindosgUtil) INCLUDE(FindOpenThreads) INCLUDE(FindosgViewer) INCLUDE(FindosgGA) INCLUDE(FindosgDB) # check for OpenCL INCLUDE(FindOpenCL) #Uncomment to enable CUDA Debugging via Parallel NSight #SET(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -G) ######################################################################### # Set basic include directories ######################################################################### # set include dirs SET(HEADER_PATH ${osgCompute_SOURCE_DIR}/examples/${TARGETNAME}/include) INCLUDE_DIRECTORIES( ${HEADER_PATH} ${OSG_INCLUDE_DIR} ${CUDA_TOOLKIT_INCLUDE} ) ######################################################################### # Collect header and source files and process macros ######################################################################### # collect all headers SET(TARGET_H ) SET(MY_OPENCL_SOURCE_FILES main.cl ) # Use the CUDA_COMPILE macro. #OPENCL_COMPILE( OPENCL_FILES ${MY_OPENCL_SOURCE_FILES} ) # collect the sources SET(TARGET_SRC main.cpp ${MY_OPENCL_SOURCE_FILES} ) ######################################################################### # Setup groups for resources (mainly for MSVC project folders) ######################################################################### # Setup groups for headers (especially for files with no extension) SOURCE_GROUP( "Header Files" FILES ${TARGET_H} ) # Setup groups for sources SOURCE_GROUP( "Source Files" FILES ${TARGET_SRC} ) # Setup groups for resources # First: collect the necessary files which were not collected up to now # Therefore, fill the following variables: # MY_ICE_FILES - MY_MODEL_FILES - MY_SHADER_FILES - MY_UI_FILES - MY_XML_FILES # collect shader files SET(MY_SHADER_FILES ) # finally, use module to build groups INCLUDE(GroupInstall) # now set up the ADDITIONAL_FILES variable to ensure that the files will be visible in the project # and/or that they are forwarded to the linking stage SET(ADDITIONAL_FILES #${MY_SHADER_FILES} #${OPENCL_FILES} ${MY_OPENCL_SOURCE_FILES} ) ######################################################################### # Setup libraries to link against ######################################################################### # put here own project libraries, for example. (Attention: you do not have # to differentiate between debug and optimized: this is done automatically by cmake SET(TARGET_ADDITIONAL_LIBRARIES osgCompute osgOpenCL #osgOpenCLStats ) # put here the libraries which are collected in a variable (i.e. most of the FindXXX scrips) # the macro (LINK_WITH_VARIABLES) ensures that also the ${varname}_DEBUG names will resolved correctly SET(TARGET_VARS_LIBRARIES OPENTHREADS_LIBRARY OSG_LIBRARY OSGUTIL_LIBRARY #added by sajjad - the opencl library to link with OPENCL_LIBRARIES ) ######################################################################### # Example setup and install ######################################################################### # this is a user definded macro which does all the work for us # it also takes into account the variables TARGET_SRC, # TARGET_H and TARGET_ADDITIONAL_LIBRARIES and TARGET_VARS_LIBRARIES and ADDITIONAL_FILES SETUP_EXAMPLE(${TARGETNAME})
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake