Hello Boost users

I have here a strange problem which occurs only if I try to build with
precompiled headers using CMake. I've configured the project for use
with dynamically linking. The error is:

/usr/bin/ld:
/usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/crt1.o: in
function `_start':
(.text+0x24): undefined reference to `main'

Something obvious?

Thanks in advance


The project's reduce is:

[...]

attached a minimal example. So it can be reproduced.

project(boost_utf_pch LANGUAGES CXX)
cmake_minimum_required(VERSION 3.18)

add_executable(${PROJECT_NAME} "")

find_package(Boost 1.73.0 REQUIRED COMPONENTS 
    unit_test_framework 
)

target_sources(${PROJECT_NAME} PRIVATE
    test_driver.cpp test.cpp
)

target_link_libraries(${PROJECT_NAME} PRIVATE
    Boost::unit_test_framework
)

set_source_files_properties(test_driver.cpp
    APPEND PROPERTIES COMPILE_DEFINITIONS "BOOST_TEST_DYN_LINK" 
)

option(EDA_ENABLE_PCH "Enable PCH" ON)
set(CMAKE_VERBOSE_MAKEFILE ON)

if (EDA_ENABLE_PCH)
    target_precompile_headers(${PROJECT_NAME} PRIVATE 
        pch.hpp
    )
endif()

#pragma once
#include <boost/test/unit_test.hpp>

#include <boost/test/unit_test.hpp>

BOOST_AUTO_TEST_SUITE( my_test )


BOOST_AUTO_TEST_CASE( test_case1 )
{
  BOOST_TEST_WARN( sizeof(int) < 4U );
}

BOOST_AUTO_TEST_SUITE_END()
#define BOOST_TEST_MODULE "Boost.UTF PCH Test Suite"
#include <boost/test/unit_test.hpp>

_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
https://lists.boost.org/mailman/listinfo.cgi/boost-users

Reply via email to