0

I run cmake in command prompt with:

mkdir build && cd build
.. cmake

But now, I have problem constructing the command to build realease static. I tried:

C:\Users\Kuba\Downloads\rabbitmq-c>cmake --build  build --BUILD_STATIC_LIBS=ON

Which yields the error:

Unknown argument --BUILD_STATIC_LIBS=ON

How to correct this? Thanks !

rocambille
  • 15,398
  • 12
  • 50
  • 68
Kuba
  • 39
  • 1
  • 6
  • You can also use cmake-gui to set these variables in a GUI. You may want to delete the build folder and try again. Since something was broken in your last comment. ALL_BUILD should always exist in a Visual Studio CMake generated project. – drescherjm Nov 25 '16 at 14:53
  • @drescherjm thanks , I will try – Kuba Nov 26 '16 at 21:36

2 Answers2

1

You should define the variable using the -D option:

cmake --build  build -DBUILD_STATIC_LIBS=ON

Please read the documentation for more information.

Some programmer dude
  • 400,186
  • 35
  • 402
  • 621
  • 2
    To have any effect, this would have to be specified when *generating,* not when *building.* – Angew is no longer proud of SO Nov 25 '16 at 12:31
  • Now I try: C:\Users\Kuba\Downloads\rabbitmq-c\build>cmake --build . Microsoft (R) Build Engine version 14.0.25420.1 Copyright (C) Microsoft Corporation. All rights reserved. MSBUILD : error MSB1009: Project file does not exist. Switch: ALL_BUILD.vcxproj – Kuba Nov 25 '16 at 12:41
1

Configuring the build is a separate step from building it.

From the source directory create a binary directory:

mkdir build && cd build

Then configure the build (this is where you can add other build-flags):

cmake -DBUILD_STATIC_LIBS=ON ..

then build it:

cmake --build .
alanxz
  • 1,966
  • 15
  • 17
  • @alanxyz I compile rabbit-c in version "-s-mt" and now when I try static compile with wrapper SimpleAmqpClient i get some error when linking c library , could you help me ? I no have idea ... http://pastebin.com/DqNiaUVz – Kuba Nov 27 '16 at 03:29
  • @JakubJańczak-Zarycki - SimpleAmqpClient cannot currently be built statically on Win32. – alanxz Nov 28 '16 at 00:56
  • @alanxyz , future ? – Kuba Nov 30 '16 at 00:28
  • @JakubJańczak-Zarycki perhaps. – alanxz Dec 02 '16 at 05:49