"This file does not belong to any project target..."

In my project direcotry, I have: "main.cu" and "lib.cuh".

 

My make file is:

cmake_minimum_required(VERSION 3.8 FATAL_ERROR)

# set project name and languages
project(target LANGUAGES CXX CUDA)

# add header-only files
add_library(lib INTERFACE)
target_sources(lib INTERFACE lib.cuh)
target_include_directories(lib INTERFACE "${PROJECT_SOURCE_DIR}")

# target
add_executable(target main.cu)
target_link_libraries(target lib)

# set NVCC flags
#set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-lineinfo;--use_fast_math;-rdc=true;-lcudadevrt")
target_compile_options(run_test PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:
--generate-line-info
--use_fast_math
--relocatable-device-code=true
-arch=sm_70
>)


# add "-std c++11" to NVCC flags
set_property(TARGET target PROPERTY CUDA_STANDARD 11)

 

Could someone tell me how to setup my directory / CMake properly s.t. "This file does not..." error is fixed?

Thanks

11 comments
Comment actions Permalink

Hi! Is the project loaded correctly? I mean, are there any errors in the CMake tool window? Do you see the "This file does not..." error for both "main.cu" and "lib.cuh"?

1
Comment actions Permalink

Thanks for your help!

 

> Is the project loaded correctly?

I am not sure how to check, but it runs fine using Clion's native Cmake build & run

 

> I mean, are there any errors in the CMake tool window?

no errors when I build, if that is what you mean by "errors on CMake tool window"

 

> Hi! Is the project loaded correctly? I mean, are there any errors in the CMake tool window? Do you see the "This file does not..." error for both "main.cu" and "lib.cuh"?

yes

0
Comment actions Permalink

Please do Tools | CMake | Reset Cache and Reload Project and copy the entire output from the CMake tool window (View | Tool Windows | CMake) here.

0
Comment actions Permalink

Here is the output:

 

```

/usr/local/bin/cmake -DCMAKE_BUILD_TYPE= -DCMAKE_MAKE_PROGRAM=/bin/make -DCMAKE_C_COMPILER=/bin/gcc -DCMAKE_CXX_COMPILER=/bin/g++ -G "CodeBlocks - Unix Makefiles" /home/minds/isaac/tf_bilinear_upsample
-- The CXX compiler identification is GNU 4.8.5
-- The CUDA compiler identification is NVIDIA 10.0.130
-- Check for working CXX compiler: /bin/g++
-- Check for working CXX compiler: /bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working CUDA compiler: /usr/local/cuda/bin/nvcc
-- Check for working CUDA compiler: /usr/local/cuda/bin/nvcc -- works
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Configuring done
CMake Error in CMakeLists.txt:
Target "lib" contains relative path in its INTERFACE_SOURCES:

"tf_upsample_final.cuh"


-- Generating done
-- Build files have been written to: /home/minds/isaac/tf_bilinear_upsample
CMake Warning:
Manually-specified variables were not used by the project:

CMAKE_C_COMPILER

 

[Failed to reload]

```

 

It's my first time using CMake, so could you help me troubleshoot? 

 

Thanks so much!

0
Comment actions Permalink

I was able to fix the above Cmake error. However, in the "Debug" Cmake console, I get the error statemet:

```

Cannot generate 'Debug' into /home/minds/isaac/tf_bilinear_upsample
CMakeCache.txt is found in the project dir, only in-source generation will be performed.

[Failed to reload]

```

and all the files still display the error message "This file does not belong to any project target..."

0
Comment actions Permalink

Is /home/minds/isaac/tf_bilinear_upsample your project folder? Have you changed the Generation path option in File | Settings | Build, Execution, Deployment | CMake? CLion should generate CMake files in the cmake-build-debug subfolder by default.

0
Comment actions Permalink

/home/minds/isaac/tf_bilinear_upsample this is a remote path mapped to my local project folder, not my local project folder.

 

Generation path for both default and debug are set as: /home/minds/isaac/tf_bilinear_upsample and I have not touched this.

 

0
Comment actions Permalink

A remote path? Do you use the full remote mode?

Please describe how your development process is organized, I don't understand it.

0
Comment actions Permalink

I got this when I copied a file from another project into a new project I was working on.  When I tried to make changes I got this error with possible actions like "I want to edit this file anyway..."  It would seem useful to offer the additional option "Add this file to my project" -- of course if it's a symlink to the other projects file then that's not a viable thing to do without some sort of "clone/copy" done ahead of assigning ownership to the project, but I think that could be managed.

0

Please sign in to leave a comment.