Reputation: 21
I am using python's cmake-converter in order to generate cmake files from a .sln project.
In visual studio I am trying to generate the cmake files for WSL-GCC-Debug configuration.
When Visual Studio starts the CMake generation I get this error
[CMake] CMake Error at <path to Example>/CMakeLists.txt:220 (add_library):
[CMake] Target '<Example>' OUTPUT_NAME depends on itself.
CMakeLists.txt looks like this:
1 set(PROJECT_NAME Example)
2 set(no_group_source_files
...
100 Example.h
...
180 )
181 source_group("" FILES ${no_group_source_files})
182 set(ALL_FILES
183 ${no_group_source_files}
184 )
...
220 add_library(${PROJECT_NAME} SHARED ${ALL_FILES})
There was an open issue about this here but I don't see an answer that helps my case
I am new to cmake and trying to debug this. Does anyone have any idea why this happens and how I can fix it?
Upvotes: 1
Views: 847
Reputation: 21
Eventually I found this solution to the problem.
Edit Default.cmake in CMake folder (CMake/Default.cmake)
Change
create_property_reader("TARGET_NAME")
To some other name except TARGET_NAME i.e
create_property_reader("TARGET_NAME_1")
Upvotes: 1