Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build only debug by Visual Studio generator in CMakeSettings #28

Closed
tav7c3 opened this issue Jan 23, 2020 · 3 comments
Closed

Build only debug by Visual Studio generator in CMakeSettings #28

tav7c3 opened this issue Jan 23, 2020 · 3 comments

Comments

@tav7c3
Copy link

tav7c3 commented Jan 23, 2020

Hello!

There is a configuration

  • azure-devops.cmakesettings.json
{
 "configurations": [
   {
      "name": "x64-windows",
      "configurationType": "Release",
      "inheritEnvironments": [ "msvc_x64" ],
      "buildCommandArgs": "",
      "cmakeCommandArgs": "",
      "ctestCommandArgs": "",
      "generator": "Visual Studio 16 2019 Win64"
   }
 ]
}
  • azure-pipelines.yml
  - task: run-cmake@0
    displayName: 'Run CMake with CMakeSettings.json'
    inputs:
      cmakeListsOrSettingsJson: 'CMakeSettingsJson'
      cmakeSettingsJsonPath: 'azure-devops.cmakesettings.json'
      useVcpkgToolchainFile: false
      configurationRegexFilter: '^(x64-windows)$'

CMake configure stage is correct:

Overriding build directory to: 'C:\agent\_work\1\a\x64-windows'
"C:\Program Files\CMake\bin\cmake.exe" -G "Visual Studio 16 2019" -A x64 -DCMAKE_BUILD_TYPE=Release C:\agent\_work\1\s
-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.17763.
-- The CXX compiler identification is MSVC 19.24.28314.0
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Failed
-- Performing Test COMPILER_HAS_DEPRECATED
-- Performing Test COMPILER_HAS_DEPRECATED - Success
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_BUILD_TYPE


-- Build files have been written to: C:/agent/_work/1/a/x64-windows

But build stage is build Debug configuration:

Building with CMake in build directory 'C:\agent\_work\1\a\x64-windows' ...
"C:\Program Files\CMake\bin\cmake.exe" --build . --
Microsoft (R) Build Engine version 16.4.0+e901037fe for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

  Checking Build System
  Building Custom Rule C:/agent/_work/1/s/CMakeLists.txt
  main.cpp
     Creating library C:/agent/_work/1/a/x64-windows/Debug/sample-addin.lib and object C:/agent/_work/1/a/x64-windows/Debug/sample-addin.exp
  sample-addin.vcxproj -> C:\agent\_work\1\a\x64-windows\bin\Debug\sample-addin.dll
  Building Custom Rule C:/agent/_work/1/s/test/CMakeLists.txt
  main.cpp
  test-sample-addin.vcxproj -> C:\agent\_work\1\a\x64-windows\bin\Debug\test-sample-addin.exe
  Building Custom Rule C:/agent/_work/1/s/CMakeLists.txt

This is because no configuration is specified in cmake --build
Similar problem

buildWithCMakeArgs: '--config Release' is ignored for CMakeSettingsJson

Сan you fix it please. Ninja generator doesn't always fit, and I'm not very into JS to fix it.
buildWithCMakeArgs

Thanks.

@lukka
Copy link
Owner

lukka commented Jan 24, 2020

Right, the --config Release is missing indeed. It should match the configurationType value. This should be fixed in the run-cmake task.

p.s. If you switch to Ninja this would solve the problem, and you would get faster builds too.

@tav7c3
Copy link
Author

tav7c3 commented Jan 24, 2020

Thanks for the recommendation, but Ninja does not support toolset specification (

Does run-cmake task support "environments" in CMakeSettingsJson? Could use this solution.

@lukka
Copy link
Owner

lukka commented Jan 26, 2020

I am going to add a test to verify the whether the environment is correctly set up.
What compiler are you using? On windows the task sets the environment of the VS Developer Command Prompt, it would work if you use msvc with Ninja.

@lukka lukka closed this as completed Jan 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants