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

CMake generate fails for MSVC since commit 44b0faf #232

Closed
vehystrix opened this issue Dec 5, 2018 · 3 comments
Closed

CMake generate fails for MSVC since commit 44b0faf #232

vehystrix opened this issue Dec 5, 2018 · 3 comments
Assignees

Comments

@vehystrix
Copy link

The following internal change causes CMake to no longer generate for MSVC since commit 44b0faf:

c2014e2704b87e7cdce2d2a0287c7e2397752296 by Abseil Team absl-team@google.com:

Update absl/debugging/CMakeLists.txt to use new functions
i.e. absl_cc_(library|test)

PiperOrigin-RevId: 223751986

The culprit seems to be lines 180-191 in absl/debugging/CMakeLists.txt

absl_cc_library(
  NAME
    leak_check
  HDRS
    "$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:leak_check.h>"
  SRCS
    "$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:leak_check.cc>"
  COPTS
    ${ABSL_DEFAULT_COPTS}
  DEPS
    absl::core_headers
  PUBLIC
)

Which causes the leak_check library to be added with no sources if the compiler is MSVC

Below is the CMake output:
(clean checkout of the latest commit, and generating/building to an empty folder)

1> -- The C compiler identification is MSVC 19.16.27024.1
1> -- The CXX compiler identification is MSVC 19.16.27024.1
1> -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/bin/HostX64/x64/cl.exe
1> -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/bin/HostX64/x64/cl.exe -- works
1> -- Detecting C compiler ABI info
1> -- Detecting C compiler ABI info - done
1> -- Detecting C compile features
1> -- Detecting C compile features - done
1> -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/bin/HostX64/x64/cl.exe
1> -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/bin/HostX64/x64/cl.exe -- works
1> -- Detecting CXX compiler ABI info
1> -- Detecting CXX compiler ABI info - done
1> -- Detecting CXX compile features
1> -- Detecting CXX compile features - done
1> -- No CMAKE_CXX_STANDARD set, assuming 11
1> -- Looking for pthread.h
1> -- Looking for pthread.h - not found
1> -- Found Threads: TRUE  
1> -- Configuring done
1> -- Build files have been written to: C:/Users/user/CMakeBuilds/86fd9bbe-015e-5b39-96b9-286f7c81ce16/build/x64-Debug (default)
1> CMake Error at CMake/AbseilHelpers.cmake:145 (add_library):
1>   No SOURCES given to target: absl_leak_check
1> Call Stack (most recent call first):
1>   a:\abseil-cpp\absl/debugging/CMakeLists.txt(180): (absl_cc_library)
@derekmauro derekmauro self-assigned this Dec 5, 2018
@derekmauro
Copy link
Member

Thanks for the report. I'll take a look.

@jcageman
Copy link

jcageman commented Feb 13, 2019

This actually still breaks CMake on the latest release of abseil on windows. Quite annoying to apply these kind of fixes myself before i could get the make working. Anything that can be done about it? For clarity: i only needed the fix in absl/debugging/CMakeLists.txt to get it working.

See build command and output below:

D:\absl>cmake -G "Visual Studio 15 2017"
CMake Warning:
  No source or binary directory provided.  Both will be assumed to be the
  same as the current working directory, but note that this warning will
  become a fatal error in future CMake releases.


-- Selecting Windows SDK version 10.0.16299.0 to target Windows 10.0.17134.
-- The C compiler identification is MSVC 19.11.25547.0
-- The CXX compiler identification is MSVC 19.11.25547.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.11.25503/bin/Hostx86/x86/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.11.25503/bin/Hostx86/x86/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.11.25503/bin/Hostx86/x86/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.11.25503/bin/Hostx86/x86/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- No CMAKE_CXX_STANDARD set, assuming 11
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Configuring done
CMake Error at CMake/AbseilHelpers.cmake:145 (add_library):
  No SOURCES given to target: absl_leak_check
Call Stack (most recent call first):
  absl/debugging/CMakeLists.txt:180 (absl_cc_library)

-- Build files have been written to: D:/absl

@derekmauro
Copy link
Member

Can you please paste the command you ran and the output?

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

3 participants