If I have a project sample
../sample/
├── build
├── CMakeLists.txt
├── main.cpp
└── release
Is the two command the same thing?
cd sample\build
cmake -S ..\
cd sample
cmake -S .\ -B build
ref:
cmake --install
If I have a project sample
../sample/
├── build
├── CMakeLists.txt
├── main.cpp
└── release
Is the two command the same thing?
cd sample\build
cmake -S ..\
cd sample
cmake -S .\ -B build
ref:
cmake --install
They look equivalent to me.
-S stands for CMAKE_SOURCE_DIR
-B stands for CMAKE_BINARY_DIR
If you don’t specify -S / -B they are implied to be your current working directory.
So yes the 2 commands shown are equivalent
The only thing that comes to mind for me is that -B
will create the build directory for you if it doesn’t exist.
In fact, the two commands will generate different size file or additional file.
Is it reasonable?
I’m not sure what you are referring to.
Here is the sample https://github.com/fmtlib/fmt
Sure, but what, exactly, are you referring to by:
method1
cd sample\build
cmake -S ..\
cmake --build xxx
cmake --install xxx
method1 result
method2
cd sample
cmake -S .\ -B build
cmake --build xxx
cmake --install xxx
method2 result
Are the two methods same for install it?
OK, so the vcxproj files look to be different sizes (though at this resolution, there could be small diffs in many of these files). But are they different in any material way?
It looks like testing wasn’t enabled for method 1. It is missing some of the files that we see with method 2 (e.g. RUN_TESTS.vcxproj*
and CTestTestfile.cmake
). I have no explanation, just making an observation.
That feels like one had ENABLE_TESTING=ON
(or OFF
. That could certainly increase the file sizes as well.
ENABLE_TESTING=ON no use with command.
Thanks for your help.