CMake fails to generate for Visual Studio 14 2015 with C++11

1,008 views
Skip to first unread message

Simon Cotts

unread,
Aug 9, 2016, 10:36:47 AM8/9/16
to cpputest
Hello,

I'm new to using CppUTest (3.8) and CMake (3.6.1), running on Windows 7 64-bit.

I'm trying to generate a solution for Visual Studio 14 2015 in order to build the CppUTest libraries. (Which is correct to the best of my knowledge...)

I need C++11 support, but CMake cannot find 'CXX11', selecting the default compilers.

Source code is in: C:/cpputest-3.8, Binary files are being built in: C:/cpputest-3.8/bin

CMake Configure Output:

The C compiler identification is MSVC 19.0.24213.1

The CXX compiler identification is MSVC 19.0.24213.1

Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe

Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe -- works

Detecting C compiler ABI info

Detecting C compiler ABI info - failed

Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe

Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe -- works

Detecting CXX compiler ABI info

Detecting CXX compiler ABI info - failed

Detecting CXX compile features

Detecting CXX compile features - failed

Looking for fork

Looking for fork - not found

Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)


-------------------------------------------------------

CppUTest Version 3.8


Current compiler options:

CC: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe

CXX: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe

CppUTest CFLAGS: /FI "C:/cpputest-3.8/include/CppUTest/MemoryLeakDetectorMallocMacros.h" /WX

CppUTest CXXFLAGS: /FI "C:/cpputest-3.8/include/CppUTest/MemoryLeakDetectorMallocMacros.h" /WX /wd4290

CppUTest LDFLAGS:


Features configured in CppUTest:

Memory Leak Detection: ON

Compiling Extensions: ON

Support Long Long: OFF

Use CppUTest flags: ON


Using Standard C library: ON

Using Standard C++ library: ON

Using C++11 library: OFF


Generating map file: OFF

Compiling with coverage: OFF


Compile and run self-tests ON

Run self-tests separately OFF


-------------------------------------------------------

Configuring done

 

CMake Generate Output:

Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)

Try C++11 flag = [ ]

Performing Test CXX11_FLAG_DETECTED

Performing Test CXX11_FLAG_DETECTED - Failed

Try C++11 flag = [-std=c++11]

Performing Test CXX11_FLAG_DETECTED

Performing Test CXX11_FLAG_DETECTED - Failed

Try C++11 flag = [/Qstd=c++0x]

Performing Test CXX11_FLAG_DETECTED

Performing Test CXX11_FLAG_DETECTED - Failed

CMake Error at C:/Program Files/CMake/share/cmake-3.6/Modules/FindPackageHandleStandardArgs.cmake:148 (message):

Could NOT find CXX11 (missing: CXX11_FLAGS)

Call Stack (most recent call first):

C:/Program Files/CMake/share/cmake-3.6/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)

cmake/Modules/FindCXX11.cmake:48 (find_package_handle_standard_args)

cmake/Modules/CppUTestConfigurationOptions.cmake:56 (find_package)

CMakeLists.txt:51 (include)


Configuring incomplete, errors occurred!

See also "C:/cpputest-3.8/bin/CMakeFiles/CMakeOutput.log".

See also "C:/cpputest-3.8/bin/CMakeFiles/CMakeError.log".


Also, please find CMakeOutput.log and CMakeError.log attached. 

CMakeOutput.log
CMakeError.log

Martin Ertsås

unread,
Aug 10, 2016, 12:51:55 AM8/10/16
to cpputest
This test seems in need of updating, as the flags have changed a bit. In cmake/Modules there is a FindCXX11.cmake file. Can you try to add:

/Qstd=c++11

to the CXX11_FLAG_CANDIDATES and tell me if that works?

- Martin

--
You received this message because you are subscribed to the Google Groups "cpputest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cpputest+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Simon Cotts

unread,
Aug 10, 2016, 3:25:29 AM8/10/16
to cpputest
Unfortunately I get the same result:

FindCXX11.cmake:

set(CXX11_FLAG_CANDIDATES
    # Eveerything that automatically accepts C++11
    " "
    # gcc, clang and Intel Linux
    "-std=c++11"
    # Intel windows
    "/Qstd=c++0x"
    "/Qstd=c++11"
    )

CMake Generate:

Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)

Try C++11 flag = [ ]

Performing Test CXX11_FLAG_DETECTED

Performing Test CXX11_FLAG_DETECTED - Failed

Try C++11 flag = [-std=c++11]

Performing Test CXX11_FLAG_DETECTED

Performing Test CXX11_FLAG_DETECTED - Failed

Try C++11 flag = [/Qstd=c++0x]

Performing Test CXX11_FLAG_DETECTED

Performing Test CXX11_FLAG_DETECTED - Failed

Try C++11 flag = [/Qstd=c++11]

Performing Test CXX11_FLAG_DETECTED

Performing Test CXX11_FLAG_DETECTED - Failed

CMake Error at C:/Program Files/CMake/share/cmake-3.6/Modules/FindPackageHandleStandardArgs.cmake:148 (message):

Could NOT find CXX11 (missing: CXX11_FLAGS)

Call Stack (most recent call first):

C:/Program Files/CMake/share/cmake-3.6/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)

cmake/Modules/FindCXX11.cmake:50 (find_package_handle_standard_args)

Martin Ertsås

unread,
Aug 10, 2016, 3:56:28 AM8/10/16
to cpputest

Weird. I'll have a closer look on what we're actually trying to run in that test


--
You received this message because you are subscribed to the Google Groups "cpputest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cpputest+unsubscribe@googlegroups.com.

Martin Ertsås

unread,
Aug 10, 2016, 7:12:39 AM8/10/16
to cpputest
Seems like Visual Studio has a bug with the __cplusplus macro: https://connect.microsoft.com/VisualStudio/feedback/details/763051/a-value-of-predefined-macro-cplusplus-is-still-199711l

Since I don't have a Windows box, I need some help to find a solution.

Could you try to change the lines:

#if __cplusplus < 201103L
#error \"Can not compile with C++11\"
#endif

to

#if defined(_MSC_VER) && _MSC_VER < 1800
#error \"Can not compile with C++11 support\"
#elif __cplusplus < 201103L
#endif
#error \"Can not compile with C++11 support\"
#endif

Something like that should work.

To unsubscribe from this group and stop receiving emails from it, send an email to cpputest+u...@googlegroups.com.

Simon Cotts

unread,
Aug 10, 2016, 7:38:06 AM8/10/16
to cpputest
Assuming this is correct:

FindCXX11.cmake:

set(CXX11_TEST_SOURCE
"
#if defined(_MSC_VER) && _MSC_VER < 1800
#error \"Can not compile with C++11 support\"
#elif __cplusplus < 201103L
#endif
#error \"Can not compile with C++11 support\"
#endif

int main()
{}
")

I get no change to the previous CMake output.

Martin Ertsås

unread,
Aug 10, 2016, 7:40:21 AM8/10/16
to cppu...@googlegroups.com
Just saw that it is not correct. try:

#if defined(_MSC_VER)
#if _MSC_VER < 1800
#error \"Can not compile with C++11 support\"
#endif
#elif __cplusplus < 201103L
#error ...
#endif

Simon Cotts

unread,
Aug 10, 2016, 8:03:17 AM8/10/16
to cpputest
Many thanks Martin; It now generates OK!

CMake Generate:

Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)

Try C++11 flag = [ ]

Performing Test CXX11_FLAG_DETECTED

Performing Test CXX11_FLAG_DETECTED - Success

Martin Ertsås

unread,
Aug 10, 2016, 8:16:38 AM8/10/16
to cpputest
can you change make a pull request with that change?

Simon Cotts

unread,
Aug 10, 2016, 8:52:40 AM8/10/16
to cpputest
Sorry no; I'm unsure how to go about doing that!

Martin Ertsås

unread,
Aug 10, 2016, 9:21:41 AM8/10/16
to cpputest

Ok. Then I'll do it a bit later.


To unsubscribe from this group and stop receiving emails from it, send an email to cpputest+unsubscribe@googlegroups.com.

Martin Ertsås

unread,
Aug 11, 2016, 4:51:13 AM8/11/16
to cpputest
FYI: This have been merged now.
Reply all
Reply to author
Forward
0 new messages