So I was running a project in Qt creator which was going relatively ok, where I needed to generate some protobuf files and link against them. So I used conan:
# conan
if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan")
file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/master/conan.cmake" "${CMAKE_BINARY_DIR}/conan.cmake")
endif()
include(${CMAKE_BINARY_DIR}/conan.cmake)
conan_cmake_run(CONANFILE conanfile.txt
BASIC_SETUP
CMAKE_TARGETS
BUILD missing
)
And then
find_package(protobuf REQUIRED)
PROTOBUF_GENERATE_CPP(proto_h proto_c ${proto_files})
and then added those to "add_executable". Everything worked. Until I had to port this to Visual studio, where no files are being generated, and it does not seem like any custom build step related to Protobuf generation was added. I can't understand where is the issue. Also, CmakeGui was not able to find default protobuf related variables for some reason (Protobuf_LIBRARY_DEBUG-NOTFOUND etc.) but it was configured with no errors nonetheless (and PROTOBUF_GENERATE_CPP gave me file names to add the executable and it didn't swear that It can't find them = It should have found the protoc target to use it in its proto generation task).
So at this point I am out of Ideas and so frustrated because it seems that I have to resort to a manual protobuf download/install/search which might not even work=( Can someone give an idea why such things happen? Why QtCreator is perfectly capable of running CMake scripts while Visual studio files generated by the same CMake GUI the QtCreator has, cant?
UPDATE: Weirdly enough, after I opend CmakeLists in Visual studio and used x64-Configuration, everything worked. Although I had to manually type CMAKE_PREFIX_PATH Does it mean CmakeGui does not generate well?