Running cmake in a different build directory on Windows












0















I run CMake using cmake .. in order to make it output all the generated files in a different directory. This runs fine on Ubuntu, but breaks on Windows 10 when I try to run it. Running cmake . from the root project directory seems to work fine on both platforms. The output of cmake .. on Windows is:



PS D:Developmentcpphello-vulkanbuild> cmake ..
-- Building for: Visual Studio 15 2017
-- Selecting Windows SDK version 10.0.16299.0 to target Windows 10.0.17134.
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:3 (project):
No CMAKE_C_COMPILER could be found.
CMake Error at CMakeLists.txt:3 (project):
No CMAKE_CXX_COMPILER could be found.
-- Configuring incomplete, errors occurred!


The CMakeLists.txt is specified here:



include(${CMAKE_ROOT}/Modules/ExternalProject.cmake)
cmake_minimum_required(VERSION 3.10)
project(hello_vulkan)

# Download and setup GLFW
set(GLFW_DIR ${PROJECT_SOURCE_DIR}/lib/glfw)
set(GLFW_BINARY_DIR ${GLFW_DIR}/bin)
ExternalProject_Add(
glfw
PREFIX ${GLFW_DIR}
GIT_REPOSITORY https://github.com/glfw/glfw.git
GIT_TAG 3.2.1
INSTALL_DIR ${GLFW_BINARY_DIR}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${GLFW_BINARY_DIR}
)

# Link Vulkan and GLFW
set(VULKAN_DIR ${PROJECT_SOURCE_DIR}/lib/vulkan)
include_directories(${VULKAN_DIR}/include)
link_directories(
${VULKAN_DIR}/lib
${GLFW_BINARY_DIR}
)

# Setup project
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/build/)
set(SOURCES source/main.cpp)

add_executable(hello_vulkan ${SOURCES})
add_dependencies(hello_vulkan glfw)


Any ideas what to do for it to work when running from a different directory on Windows?



Edit:
Here is the output from cmake .. on Ubuntu:



cmake ..
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /mnt/d/Development/cpp/hello-vulkan/build









share|improve this question




















  • 1





    Hi bartlomiej.n, this looks quite surprising, could you also include the output from cmake . run from source dir, and check whether you indeed mentioned all cmake file in you questions?

    – Silmathoron
    Nov 21 '18 at 19:41








  • 1





    Otherwise, possible problems on Windows usually come from whitespaces in the folder names (e.g. "Program Files"), so you might want to quote all your paths, though I don't see why this would not happen with cmake ....

    – Silmathoron
    Nov 21 '18 at 19:43











  • Yes, I included the whole CMakeLists.txt file here. There's not much more in the project really except for that - a "hello world" main.cpp file and Vulkan headers/libraries in the lib folder the project. There is no whitespace in folder names anywhere. C/C++ compilers are recognized without a problem on cmake .. I'll provide the output of this command later today on both platforms once I get back from work.

    – bartlomiej.n
    Nov 22 '18 at 12:25








  • 1





    did you make any progress on this issue? I'm curious about what could cause this...

    – Silmathoron
    Nov 23 '18 at 21:48






  • 1





    did you try forcing the compiler? you can find an example here

    – Silmathoron
    Nov 24 '18 at 17:20
















0















I run CMake using cmake .. in order to make it output all the generated files in a different directory. This runs fine on Ubuntu, but breaks on Windows 10 when I try to run it. Running cmake . from the root project directory seems to work fine on both platforms. The output of cmake .. on Windows is:



PS D:Developmentcpphello-vulkanbuild> cmake ..
-- Building for: Visual Studio 15 2017
-- Selecting Windows SDK version 10.0.16299.0 to target Windows 10.0.17134.
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:3 (project):
No CMAKE_C_COMPILER could be found.
CMake Error at CMakeLists.txt:3 (project):
No CMAKE_CXX_COMPILER could be found.
-- Configuring incomplete, errors occurred!


The CMakeLists.txt is specified here:



include(${CMAKE_ROOT}/Modules/ExternalProject.cmake)
cmake_minimum_required(VERSION 3.10)
project(hello_vulkan)

# Download and setup GLFW
set(GLFW_DIR ${PROJECT_SOURCE_DIR}/lib/glfw)
set(GLFW_BINARY_DIR ${GLFW_DIR}/bin)
ExternalProject_Add(
glfw
PREFIX ${GLFW_DIR}
GIT_REPOSITORY https://github.com/glfw/glfw.git
GIT_TAG 3.2.1
INSTALL_DIR ${GLFW_BINARY_DIR}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${GLFW_BINARY_DIR}
)

# Link Vulkan and GLFW
set(VULKAN_DIR ${PROJECT_SOURCE_DIR}/lib/vulkan)
include_directories(${VULKAN_DIR}/include)
link_directories(
${VULKAN_DIR}/lib
${GLFW_BINARY_DIR}
)

# Setup project
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/build/)
set(SOURCES source/main.cpp)

add_executable(hello_vulkan ${SOURCES})
add_dependencies(hello_vulkan glfw)


Any ideas what to do for it to work when running from a different directory on Windows?



Edit:
Here is the output from cmake .. on Ubuntu:



cmake ..
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /mnt/d/Development/cpp/hello-vulkan/build









share|improve this question




















  • 1





    Hi bartlomiej.n, this looks quite surprising, could you also include the output from cmake . run from source dir, and check whether you indeed mentioned all cmake file in you questions?

    – Silmathoron
    Nov 21 '18 at 19:41








  • 1





    Otherwise, possible problems on Windows usually come from whitespaces in the folder names (e.g. "Program Files"), so you might want to quote all your paths, though I don't see why this would not happen with cmake ....

    – Silmathoron
    Nov 21 '18 at 19:43











  • Yes, I included the whole CMakeLists.txt file here. There's not much more in the project really except for that - a "hello world" main.cpp file and Vulkan headers/libraries in the lib folder the project. There is no whitespace in folder names anywhere. C/C++ compilers are recognized without a problem on cmake .. I'll provide the output of this command later today on both platforms once I get back from work.

    – bartlomiej.n
    Nov 22 '18 at 12:25








  • 1





    did you make any progress on this issue? I'm curious about what could cause this...

    – Silmathoron
    Nov 23 '18 at 21:48






  • 1





    did you try forcing the compiler? you can find an example here

    – Silmathoron
    Nov 24 '18 at 17:20














0












0








0








I run CMake using cmake .. in order to make it output all the generated files in a different directory. This runs fine on Ubuntu, but breaks on Windows 10 when I try to run it. Running cmake . from the root project directory seems to work fine on both platforms. The output of cmake .. on Windows is:



PS D:Developmentcpphello-vulkanbuild> cmake ..
-- Building for: Visual Studio 15 2017
-- Selecting Windows SDK version 10.0.16299.0 to target Windows 10.0.17134.
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:3 (project):
No CMAKE_C_COMPILER could be found.
CMake Error at CMakeLists.txt:3 (project):
No CMAKE_CXX_COMPILER could be found.
-- Configuring incomplete, errors occurred!


The CMakeLists.txt is specified here:



include(${CMAKE_ROOT}/Modules/ExternalProject.cmake)
cmake_minimum_required(VERSION 3.10)
project(hello_vulkan)

# Download and setup GLFW
set(GLFW_DIR ${PROJECT_SOURCE_DIR}/lib/glfw)
set(GLFW_BINARY_DIR ${GLFW_DIR}/bin)
ExternalProject_Add(
glfw
PREFIX ${GLFW_DIR}
GIT_REPOSITORY https://github.com/glfw/glfw.git
GIT_TAG 3.2.1
INSTALL_DIR ${GLFW_BINARY_DIR}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${GLFW_BINARY_DIR}
)

# Link Vulkan and GLFW
set(VULKAN_DIR ${PROJECT_SOURCE_DIR}/lib/vulkan)
include_directories(${VULKAN_DIR}/include)
link_directories(
${VULKAN_DIR}/lib
${GLFW_BINARY_DIR}
)

# Setup project
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/build/)
set(SOURCES source/main.cpp)

add_executable(hello_vulkan ${SOURCES})
add_dependencies(hello_vulkan glfw)


Any ideas what to do for it to work when running from a different directory on Windows?



Edit:
Here is the output from cmake .. on Ubuntu:



cmake ..
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /mnt/d/Development/cpp/hello-vulkan/build









share|improve this question
















I run CMake using cmake .. in order to make it output all the generated files in a different directory. This runs fine on Ubuntu, but breaks on Windows 10 when I try to run it. Running cmake . from the root project directory seems to work fine on both platforms. The output of cmake .. on Windows is:



PS D:Developmentcpphello-vulkanbuild> cmake ..
-- Building for: Visual Studio 15 2017
-- Selecting Windows SDK version 10.0.16299.0 to target Windows 10.0.17134.
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:3 (project):
No CMAKE_C_COMPILER could be found.
CMake Error at CMakeLists.txt:3 (project):
No CMAKE_CXX_COMPILER could be found.
-- Configuring incomplete, errors occurred!


The CMakeLists.txt is specified here:



include(${CMAKE_ROOT}/Modules/ExternalProject.cmake)
cmake_minimum_required(VERSION 3.10)
project(hello_vulkan)

# Download and setup GLFW
set(GLFW_DIR ${PROJECT_SOURCE_DIR}/lib/glfw)
set(GLFW_BINARY_DIR ${GLFW_DIR}/bin)
ExternalProject_Add(
glfw
PREFIX ${GLFW_DIR}
GIT_REPOSITORY https://github.com/glfw/glfw.git
GIT_TAG 3.2.1
INSTALL_DIR ${GLFW_BINARY_DIR}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${GLFW_BINARY_DIR}
)

# Link Vulkan and GLFW
set(VULKAN_DIR ${PROJECT_SOURCE_DIR}/lib/vulkan)
include_directories(${VULKAN_DIR}/include)
link_directories(
${VULKAN_DIR}/lib
${GLFW_BINARY_DIR}
)

# Setup project
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/build/)
set(SOURCES source/main.cpp)

add_executable(hello_vulkan ${SOURCES})
add_dependencies(hello_vulkan glfw)


Any ideas what to do for it to work when running from a different directory on Windows?



Edit:
Here is the output from cmake .. on Ubuntu:



cmake ..
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /mnt/d/Development/cpp/hello-vulkan/build






c++ cmake






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 24 '18 at 17:11







bartlomiej.n

















asked Nov 21 '18 at 19:19









bartlomiej.nbartlomiej.n

9329




9329








  • 1





    Hi bartlomiej.n, this looks quite surprising, could you also include the output from cmake . run from source dir, and check whether you indeed mentioned all cmake file in you questions?

    – Silmathoron
    Nov 21 '18 at 19:41








  • 1





    Otherwise, possible problems on Windows usually come from whitespaces in the folder names (e.g. "Program Files"), so you might want to quote all your paths, though I don't see why this would not happen with cmake ....

    – Silmathoron
    Nov 21 '18 at 19:43











  • Yes, I included the whole CMakeLists.txt file here. There's not much more in the project really except for that - a "hello world" main.cpp file and Vulkan headers/libraries in the lib folder the project. There is no whitespace in folder names anywhere. C/C++ compilers are recognized without a problem on cmake .. I'll provide the output of this command later today on both platforms once I get back from work.

    – bartlomiej.n
    Nov 22 '18 at 12:25








  • 1





    did you make any progress on this issue? I'm curious about what could cause this...

    – Silmathoron
    Nov 23 '18 at 21:48






  • 1





    did you try forcing the compiler? you can find an example here

    – Silmathoron
    Nov 24 '18 at 17:20














  • 1





    Hi bartlomiej.n, this looks quite surprising, could you also include the output from cmake . run from source dir, and check whether you indeed mentioned all cmake file in you questions?

    – Silmathoron
    Nov 21 '18 at 19:41








  • 1





    Otherwise, possible problems on Windows usually come from whitespaces in the folder names (e.g. "Program Files"), so you might want to quote all your paths, though I don't see why this would not happen with cmake ....

    – Silmathoron
    Nov 21 '18 at 19:43











  • Yes, I included the whole CMakeLists.txt file here. There's not much more in the project really except for that - a "hello world" main.cpp file and Vulkan headers/libraries in the lib folder the project. There is no whitespace in folder names anywhere. C/C++ compilers are recognized without a problem on cmake .. I'll provide the output of this command later today on both platforms once I get back from work.

    – bartlomiej.n
    Nov 22 '18 at 12:25








  • 1





    did you make any progress on this issue? I'm curious about what could cause this...

    – Silmathoron
    Nov 23 '18 at 21:48






  • 1





    did you try forcing the compiler? you can find an example here

    – Silmathoron
    Nov 24 '18 at 17:20








1




1





Hi bartlomiej.n, this looks quite surprising, could you also include the output from cmake . run from source dir, and check whether you indeed mentioned all cmake file in you questions?

– Silmathoron
Nov 21 '18 at 19:41







Hi bartlomiej.n, this looks quite surprising, could you also include the output from cmake . run from source dir, and check whether you indeed mentioned all cmake file in you questions?

– Silmathoron
Nov 21 '18 at 19:41






1




1





Otherwise, possible problems on Windows usually come from whitespaces in the folder names (e.g. "Program Files"), so you might want to quote all your paths, though I don't see why this would not happen with cmake ....

– Silmathoron
Nov 21 '18 at 19:43





Otherwise, possible problems on Windows usually come from whitespaces in the folder names (e.g. "Program Files"), so you might want to quote all your paths, though I don't see why this would not happen with cmake ....

– Silmathoron
Nov 21 '18 at 19:43













Yes, I included the whole CMakeLists.txt file here. There's not much more in the project really except for that - a "hello world" main.cpp file and Vulkan headers/libraries in the lib folder the project. There is no whitespace in folder names anywhere. C/C++ compilers are recognized without a problem on cmake .. I'll provide the output of this command later today on both platforms once I get back from work.

– bartlomiej.n
Nov 22 '18 at 12:25







Yes, I included the whole CMakeLists.txt file here. There's not much more in the project really except for that - a "hello world" main.cpp file and Vulkan headers/libraries in the lib folder the project. There is no whitespace in folder names anywhere. C/C++ compilers are recognized without a problem on cmake .. I'll provide the output of this command later today on both platforms once I get back from work.

– bartlomiej.n
Nov 22 '18 at 12:25






1




1





did you make any progress on this issue? I'm curious about what could cause this...

– Silmathoron
Nov 23 '18 at 21:48





did you make any progress on this issue? I'm curious about what could cause this...

– Silmathoron
Nov 23 '18 at 21:48




1




1





did you try forcing the compiler? you can find an example here

– Silmathoron
Nov 24 '18 at 17:20





did you try forcing the compiler? you can find an example here

– Silmathoron
Nov 24 '18 at 17:20












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53419147%2frunning-cmake-in-a-different-build-directory-on-windows%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53419147%2frunning-cmake-in-a-different-build-directory-on-windows%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

SQL update select statement

'app-layout' is not a known element: how to share Component with different Modules