Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / openmp / libompd / src / CMakeLists.txt
blob0402a017720104f2be2caf01007a6ed281547c80
2 #//===----------------------------------------------------------------------===//
3 #//
4 #// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 #// See https://llvm.org/LICENSE.txt for license information.
6 #// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 #//
8 #//===----------------------------------------------------------------------===//
11 project (libompd)
12 cmake_minimum_required(VERSION 3.20.0)
14 add_library (ompd SHARED TargetValue.cpp omp-debug.cpp omp-state.cpp omp-icv.cpp)
16 target_link_libraries(ompd omp) # ensure generated import library is created first
18 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
20 set(LIBOMPD_LD_STD_FLAGS FALSE CACHE BOOL
21   "Use -stdlibc++ instead of -libc++ library for C++ ")
23 if(${LIBOMPD_LD_STD_FLAGS})
24 #  Find and replace/add libstdc++ to compile flags     
25    STRING( FIND "${CMAKE_CXX_FLAGS}" "-stdlib=libc++" OUT )
26    if("${OUT}" STREQUAL "-1" )   
27       set (CMAKE_CXX_FLAGS "-stdlib=libstdc++ ${CMAKE_CXX_FLAGS}")
28    else()
29       STRING( REPLACE "-stdlib=libc++" "-stdlib=libstdc++" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} )
30    endif()         
32 #  Find and replace/add libstdc++ to loader flags
33    STRING( FIND "${CMAKE_SHARED_LINKER_FLAGS}" "-stdlib=libc++" OUT )
34    if("${OUT}" STREQUAL "-1" )   
35       set (CMAKE_SHARED_LINKER_FLAGS "-stdlib=libstdc++ ${CMAKE_SHARED_LINKER_FLAGS}")         
36    else()
37       STRING( REPLACE "-stdlib=libc++" "-stdlib=libstdc++" CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} )
38    endif()
39 endif()
41 include_directories (
42         ${CMAKE_CURRENT_SOURCE_DIR}
43         ${LIBOMP_INCLUDE_DIR}
44         ${LIBOMP_SRC_DIR}
47 INSTALL( TARGETS ompd
48         LIBRARY DESTINATION ${OPENMP_INSTALL_LIBDIR}
49         ARCHIVE DESTINATION ${OPENMP_INSTALL_LIBDIR}
50         RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" )