Zitat von Brad King <[email protected]>:
On 06/29/2016 05:05 PM, Hendrik Sattler wrote:
* The "InstallRequiredSystemLibraries" module learned a new
"CMAKE_INSTALL_UCRT_LIBRARIES" option to enable app-local deployment
of the Windows Universal CRT libraries with Visual Studio 2015.
Maybe the help should note that this is only needed when targeting
WindowsXP.
It is also useful for deploying to Windows 7 machines that have
not had updates installed to provide the UCRT libraries. I've
updated the documentation to show Windows XP as an example:
InstallRequiredSystemLibraries: Document UCRT option use case
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dab3ccf2
Thanks.
* A "CMAKE_TRY_COMPILE_PLATFORM_VARIABLES" variable was added for
use by toolchain files to specify platform-specific variables that
must be propagated by the "try_compile()" command into test
projects.
Can someone please add an example to the help.
Done:
Help: Document CMAKE_TRY_COMPILE_PLATFORM_VARIABLES example
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c05d240e
E.g. I tried to make the initial try_compile() to respect my
CMAKE_CXX_FLAGS_INIT variable that gets defined in my toolchain file...
CMAKE_CXX_FLAGS_INIT is not documented for use in a toolchain file.
It is used internally by platform modules.
I really have to use CXXFLAGS environment variable which feels clumsy.
It's that really the only reliable way to define compiler arguments
like -mcpu= for all compiler invocations?
It is one way. Another way is to set the cache entry directly:
set(CMAKE_CXX_FLAGS "-mcpu=..." CACHE STRING "C++ flags")
Note that CMAKE_CXX_FLAGS is propagated by try_compile automatically.
The above two approaches are actually just trying to get a toolchain
file to have a say in the initial CMAKE_CXX_FLAGS cache entry value
of the main project.
The the following code in CMakeCXXInformation.cmake does nothing
--------------------snip--------------------
# add the flags to the cache based
# on the initial values computed in the platform/*.cmake files
# use _INIT variables so that this only happens the first time
# and you can set these flags in the cmake cache
set(CMAKE_CXX_FLAGS_INIT "$ENV{CXXFLAGS} ${CMAKE_CXX_FLAGS_INIT}")
# avoid just having a space as the initial value for the cache
if(CMAKE_CXX_FLAGS_INIT STREQUAL " ")
set(CMAKE_CXX_FLAGS_INIT)
endif()
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_INIT}" CACHE STRING
"Flags used by the compiler during all build types.")
--------------------snip--------------------
So each and every toolchain file shall also take care of the
environment variable?
How about CMAKE_CXX_FLAGS_INIT set by other module files? Ok, only 3
real users in CMake's module folder.
And VERY IMPORTANT: the toolchain file MUST make those variables CACHE
variables, else it will not work (at least CMAKE_CXX_FLAGS is only
propagated, then).
Thanks...
Hendrik
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake