Error building: "Product not found for target..."

Trying to build I am getting a "Product not found for target Blah" where Blah is the name of the project.

I know nothing about CMake. I assumed the IDE would automatically make valid CMake files. Is this not true? Do I need to learn CMake and create these CMake files by hand?

I looked in the CMake file and it lists "main.cpp" viz:

cmake_minimum_required(VERSION 3.1)
project(Featurizer)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

set(SOURCE_FILES main.cpp)
add_executable(Featurizer ${SOURCE_FILES} featurizer.c getopt.h getopt.cpp)

There is no "main.cpp" in my project. Why is it in my make file?

I started the project as empty (one of the choices) and added three source code files from scratch.

3 comments
Comment actions Permalink

Hi John.

You should edit CMakeLists.txt file manually.

If you delete main.cpp you can delete SOURCE_FILES variable (with set command):
set(SOURCE_FILES main.cpp)

and also edit add_executable command:
add_executable(Featurizer featurizer.c getopt.h getopt.cpp)

So your CMakeLists.txt may be the following:

cmake_minimum_required(VERSION 3.1)
project(Featurizer)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

add_executable(Featurizer featurizer.c getopt.h getopt.cpp)

After the editing you should reload CMake.
0
Comment actions Permalink

I am struggling with the same problem, but with a little twist ... I am adding a new target ... and it does not work ...

This is my current CMakefile ...

     cmake_minimum_required(VERSION 3.3)
     project(Algorithms_I)

     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
     set(SOURCE_FILES main.cpp)
     add_executable(Algorithms_I ${SOURCE_FILES})

     set(TEST_SOURCE_FILES test.cpp test/test.cpp test/Dummy.cpp)     
     target_include_directories(test_windows SYSTEM BEFORE PUBLIC C:\\Users\\eojojos\\include)
     add_executable(test_windows WIN32 ${TEST_SOURCE_FILES})



As you can see I have just added a new executable with its source files and some specific include directories ...  but I still cant compile.

"Product not found for target ... " error is appearing in my configuration window and I do not know what to do to solve it....

Any Help will be appreciated

0
Comment actions Permalink

Hi!

Could you please send us your project to clion-support at jetbrains.com so we can take a look at the problem on our side (without eojojos folder if it is possible).

0

Please sign in to leave a comment.