Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8767963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:57:03+00:00 2026-06-13T16:57:03+00:00

I am using the provided CMakeLists.txt file which contains the code above. What I

  • 0

I am using the provided CMakeLists.txt file which contains the code above. What I am trying to do is to compile the library using the /MT flag. Does anybody know how to do that?

Thanks in advance,

Here the code:

cmake_minimum_required(VERSION 2.6)

project(jrtplib)
set(VERSION 3.9.1)

 SET(CMAKE_C_FLAGS "/nologo /W3 /GX /Gy /YX")
       SET(CMAKE_C_FLAGS_DEBUG "/MTd /Z7 /Od")
       SET(CMAKE_C_FLAGS_RELEASE "/MT /O2")
       SET(CMAKE_C_FLAGS_MINSIZEREL "/MT /O2")
       SET(CMAKE_C_FLAGS_RELWITHDEBINFO "/MTd /Z7 /Od")

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake")

set (_DEFAULT_LIBRARY_INSTALL_DIR lib)
if (EXISTS "${CMAKE_INSTALL_PREFIX}/lib32/" AND CMAKE_SIZEOF_VOID_P EQUAL 4)
    set (_DEFAULT_LIBRARY_INSTALL_DIR lib32)
elseif (EXISTS "${CMAKE_INSTALL_PREFIX}/lib64/" AND CMAKE_SIZEOF_VOID_P EQUAL 8)
    set (_DEFAULT_LIBRARY_INSTALL_DIR lib64)
endif ()

set(LIBRARY_INSTALL_DIR "${_DEFAULT_LIBRARY_INSTALL_DIR}" CACHE PATH "Library installation directory")
if(NOT IS_ABSOLUTE "${LIBRARY_INSTALL_DIR}")
    set(LIBRARY_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${LIBRARY_INSTALL_DIR}")
endif()

include(CheckCXXCompilerFlag)
include(CheckIncludeFile)
include(CheckIncludeFileCXX)
include(CheckCXXSourceCompiles)
include(TestBigEndian)
include(${PROJECT_SOURCE_DIR}/cmake/Macros.cmake)

find_package(JThread)

set(JRTPLIB_LINK_LIBS "")
set(JRTPLIB_INTERNAL_INCLUDES "")
set(JRTPLIB_EXTERNAL_INCLUDES "")

add_additional_stuff(JRTPLIB_EXTERNAL_INCLUDES JRTPLIB_LINK_LIBS)

jrtplib_support_option("Support SDES PRIV items" JRTPLIB_SUPPORT_SDESPRIV RTP_SUPPORT_SDESPRIV ON "// No support for SDES PRIV items")
jrtplib_support_option("Support the probation mechanism for a new source" JRTPLIB_SUPPORT_PROBATION RTP_SUPPORT_PROBATION ON "// Do not wait for a number of consecutive packets to validate source")
jrtplib_support_option("Support sending RTCP APP packets" JRTPLIB_SUPPORT_SENDAPP RTP_SUPPORT_SENDAPP ON "// No direct support for sending RTCP APP packets")
jrtplib_support_option("Support sending unknown RTCP packets" JRTPLIB_SUPPORT_RTCPUNKNOWN RTP_SUPPORT_RTCPUNKNOWN OFF "// No support for sending unknown RTCP packets")
jrtplib_support_option("Support memory management mechanism" JRTPLIB_SUPPORT_MEMORYMGMT RTP_SUPPORT_MEMORYMANAGEMENT ON "// No memory management support")

jrtplib_include_test(sys/filio.h RTP_HAVE_SYS_FILIO "// Don't have <sys/filio.h>")
jrtplib_include_test(sys/sockio.h RTP_HAVE_SYS_SOCKIO "// Don't have <sys/sockio.h>")
jrtplib_include_test(ifaddrs.h RTP_SUPPORT_IFADDRS "// No ifaddrs support")

if (JTHREAD_FOUND)
    set(V "ON")
else (JTHREAD_FOUND)
    set(V "OFF")
endif (JTHREAD_FOUND)

option(JTHREAD_ENABLED "Thread support" ${V})
if (JTHREAD_ENABLED)
    set (RTP_SUPPORT_THREAD "#define RTP_SUPPORT_THREAD")
    if (JTHREAD_FOUND)
        save_paths(JRTPLIB_EXTERNAL_INCLUDES "${JTHREAD_INCLUDE_DIRS}")
        save_paths(JRTPLIB_LINK_LIBS "${JTHREAD_LIBRARIES}")
    endif(JTHREAD_FOUND)
else (JTHREAD_ENABLED)
    set (RTP_SUPPORT_THREAD "// No support for JThread was enabled")
endif (JTHREAD_ENABLED)

if (CMAKE_CROSSCOMPILING)
    option (JRTPLIB_USE_BIGENDIAN "Target platform is big endian" ON)
    if (JRTPLIB_USE_BIGENDIAN)
        set(RTP_ENDIAN "#define RTP_BIG_ENDIAN")
    else (JRTPLIB_USE_BIGENDIAN)
        set(RTP_ENDIAN "// Little endian system")
    endif (JRTPLIB_USE_BIGENDIAN)
else (CMAKE_CROSSCOMPILING)
    test_big_endian(JRTPLIB_BIGENDIAN)
    if (JRTPLIB_BIGENDIAN)
        set(RTP_ENDIAN "#define RTP_BIG_ENDIAN")
    else (JRTPLIB_BIGENDIAN)
        set(RTP_ENDIAN "// Little endian system")
    endif (JRTPLIB_BIGENDIAN)
endif (CMAKE_CROSSCOMPILING)

jrtplib_test_feature(socklentest RTP_SOCKLENTYPE_UINT TRUE "// socklen_t is 'int'")
jrtplib_test_feature(ipv4mcasttest RTP_SUPPORT_IPV4MULTICAST FALSE "// No IPv4 multicasting support")
jrtplib_test_feature(salentest RTP_HAVE_SOCKADDR_LEN FALSE "// No sa_len member in struct sockaddr")
jrtplib_test_feature(getloginrtest RTP_SUPPORT_GETLOGINR FALSE "// Not using getlogin_r")
jrtplib_test_feature(ipv6test RTP_SUPPORT_IPV6 FALSE "// No IPv6 support")
jrtplib_test_feature(ipv6mcasttest RTP_SUPPORT_IPV6MULTICAST FALSE "// No IPv6 multicasting support")

check_cxx_source_compiles("#include <stdint.h>\n#include <sys/types.h>\nint main(void) { size_t a = 0 ; size_t b = a; uint32_t x = 0; uint32_t y = x; return 0; }" JRTPLIB_STDINT)
if (JRTPLIB_STDINT)
    set(RTP_INTTYPE_HEADERS "#include <stdint.h>\n#include <sys/types.h>")
else (JRTPLIB_STDINT)
    check_cxx_source_compiles("#include <inttypes.h>\n#include <sys/types.h>\nint main(void) { uint32_t x = 0; uint32_t y = x; return 0; }" JRTPLIB_INTTYPES)
    if (JRTPLIB_INTTYPES)
        set(RTP_INTTYPE_HEADERS "#include <inttypes.h>\n#include <sys/types.h>\n")
    else (JRTPLIB_INTTYPES)
        if (NOT UNIX AND WIN32)
            set(RTP_INTTYPE_HEADERS "#include \"rtptypes_win.h\"")
        else (NOT UNIX AND WIN32)
            set(RTP_INTTYPE_HEADERS "#error Could not find header files that define types like 'uint32_t'. Please edit the file ${PROJECT_BINARY_DIR}/src/rtptypes_unix.h and make sure that the following types are defined: int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t")
            message("\n\nError: Could not find header files that define types like 'uint32_t'.\nPlease edit the file ${PROJECT_BINARY_DIR}/src/rtptypes_unix.h\nand make sure that the following types are defined: \nint8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t\n\n")
        endif (NOT UNIX AND WIN32)
    endif (JRTPLIB_INTTYPES)
endif (JRTPLIB_STDINT)

if (NOT UNIX AND WIN32)
    set(RTP_WINSOCK_HEADERS "#if defined(WIN32) || defined(_WIN32_WCE)\n    #include <winsock2.h>   \n  #include <ws2tcpip.h>\n#ifndef _WIN32_WCE\n #include <sys/types.h>\n#endif // _WIN32_WCE\n#endif // WIN32 || _WIN32_WCE\n")
endif (NOT UNIX AND WIN32)

if (NOT UNIX)
    set(JRTPLIB_COMPILE_STATIC ON CACHE BOOL "Flag indicating if a static library should be built, or a dynamic one")
    list(APPEND JRTPLIB_LINK_LIBS "ws2_32")
endif (NOT UNIX)

if (UNIX OR JRTPLIB_COMPILE_STATIC)
    set(JRTPLIB_IMPORT "")
    set(JRTPLIB_EXPORT "")
else (UNIX OR JRTPLIB_COMPILE_STATIC)
    set(JRTPLIB_IMPORT "__declspec(dllimport)")
    set(JRTPLIB_EXPORT "__declspec(dllexport)")
endif (UNIX OR JRTPLIB_COMPILE_STATIC)

configure_file("${PROJECT_SOURCE_DIR}/src/rtptypes.h.in" "${PROJECT_BINARY_DIR}/src/rtptypes.h")
configure_file("${PROJECT_SOURCE_DIR}/src/rtpconfig.h.in" "${PROJECT_BINARY_DIR}/src/rtpconfig.h")

save_paths(JRTPLIB_INTERNAL_INCLUDES "${PROJECT_SOURCE_DIR}/src" "${PROJECT_BINARY_DIR}/src")

add_subdirectory(src)
add_subdirectory(examples)

if (UNIX)
    get_target_property(JRTPLIB_LOCAL_LIBRARY_NAME jrtplib-shared LOCATION)
    get_filename_component(JRTPLIB_LIBNAME "${JRTPLIB_LOCAL_LIBRARY_NAME}" NAME)
    set(JRTPLIB_LIBS "${LIBRARY_INSTALL_DIR}/${JRTPLIB_LIBNAME}")
else (UNIX)
    if (JRTPLIB_COMPILE_STATIC)
        get_target_property(JRTPLIB_LOCAL_LIBRARY_NAME jrtplib-static RELEASE_LOCATION)
        get_filename_component(JRTPLIB_LIBNAME_RELEASE "${JRTPLIB_LOCAL_LIBRARY_NAME}" NAME_WE)
        get_target_property(JRTPLIB_LOCAL_LIBRARY_NAME jrtplib-static DEBUG_LOCATION)
        get_filename_component(JRTPLIB_LIBNAME_DEBUG "${JRTPLIB_LOCAL_LIBRARY_NAME}" NAME_WE)
    else (JRTPLIB_COMPILE_STATIC)
        get_target_property(JRTPLIB_LOCAL_LIBRARY_NAME jrtplib-shared RELEASE_LOCATION)
        get_filename_component(JRTPLIB_LIBNAME_RELEASE "${JRTPLIB_LOCAL_LIBRARY_NAME}" NAME_WE)
        get_target_property(JRTPLIB_LOCAL_LIBRARY_NAME jrtplib-shared DEBUG_LOCATION)
        get_filename_component(JRTPLIB_LIBNAME_DEBUG "${JRTPLIB_LOCAL_LIBRARY_NAME}" NAME_WE)
    endif (JRTPLIB_COMPILE_STATIC)
    set(JRTPLIB_LIBS optimized "${LIBRARY_INSTALL_DIR}/${JRTPLIB_LIBNAME_RELEASE}.lib" 
                 debug "${LIBRARY_INSTALL_DIR}/${JRTPLIB_LIBNAME_DEBUG}.lib")
endif (UNIX)

set(JRTPLIB_INCDIRS ${JRTPLIB_EXTERNAL_INCLUDES} ${CMAKE_INSTALL_PREFIX}/include)
set(JRTPLIB_LIBS ${JRTPLIB_LIBS} ${JRTPLIB_LINK_LIBS})
remove_empty(JRTPLIB_INCDIRS)
list(REMOVE_DUPLICATES JRTPLIB_INCDIRS)
remove_empty(JRTPLIB_LIBS)

foreach(ARG ${JRTPLIB_LIBS})
    set(JRTPLIB_LIBS_CMAKECONFIG "${JRTPLIB_LIBS_CMAKECONFIG} \"${ARG}\"")
endforeach()
foreach(ARG ${JRTPLIB_INCDIRS})
    set(JRTPLIB_INCDIRS_CMAKECONFIG "${JRTPLIB_INCDIRS_CMAKECONFIG} \"${ARG}\"")
endforeach()

configure_file("${PROJECT_SOURCE_DIR}/cmake/JRTPLIBConfig.cmake.in" "${PROJECT_BINARY_DIR}/cmake/JRTPLIBConfig.cmake")
install(FILES "${PROJECT_BINARY_DIR}/cmake/JRTPLIBConfig.cmake" DESTINATION ${LIBRARY_INSTALL_DIR}/cmake/JRTPLIB)

if (UNIX)
    foreach(ARG ${JRTPLIB_LIBS})
        set(JRTPLIB_LIBS_PKGCONFIG "${JRTPLIB_LIBS_PKGCONFIG} ${ARG}")
    endforeach()
    foreach(ARG ${JRTPLIB_INCDIRS})
        set(JRTPLIB_INCDIRS_PKGCONFIG "${JRTPLIB_INCDIRS_PKGCONFIG} -I${ARG}")
    endforeach()

    configure_file(${PROJECT_SOURCE_DIR}/pkgconfig/jrtplib.pc.in ${PROJECT_BINARY_DIR}/pkgconfig/jrtplib.pc)
    install(FILES ${PROJECT_BINARY_DIR}/pkgconfig/jrtplib.pc DESTINATION ${LIBRARY_INSTALL_DIR}/pkgconfig)
endif (UNIX)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T16:57:05+00:00Added an answer on June 13, 2026 at 4:57 pm

    Adding flags to CMAKE_C_FLAGS and friends is the proper way to pass specific flags to the compiler, but the CMAKE_C_* variables only affect compilation of C files.

    If you have any C++ files in the project, you’ll also need to set CMAKE_CXX_FLAGS and friends.

    Also, you can do this without modifying the CMakeLists file, in cmake-gui or ccmake. After configuring once, you can see the default values for these variables in cmake-gui or ccmake. Then, you can change some of the variables directly in the app, configure again, and voila: you’ve set the flags for your build tree without modifying any code.

    If you always want the flags, then modifying the code is the right approach. But if you’re just trying to get a build done, you can set the flags without touching the code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying IPN callback, using servlet. The code I am using is provided
I've been trying to retrieve Google analytics reports using their provided .NET api and
I am using Bouncy Castle provided library to encrypt,decrypt,sign and verify sign. I am
I am using the sample provided here and have used the code inside a
I'm using the code provided below to display time and date. can anyone help
I am trying to build some simulation software using makefile provided by them after
I am using instructions provided at http://code.google.com/appengine/articles/openid.html to enable Federated Authentication in App Engine.
I am trying to map a 1D array onto 3D array using provided list
I'm using code provided in this answer to create a dynamic label and it
I start the msysGit Bash using the provided batch file (the one that simulates

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.